#NEWLINE# def flatten( self , primary , **related ) : #NEWLINE# #INDENT# '\n        Returns a dictionary representing a single "row" of data, created by\n        merging the fields from multiple mapper models/documents.\n        ' #NEWLINE# flat = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# primary . pop ( '_id' , None ) #NEWLINE# for fname in self . _relationships . keys ( ) : #NEWLINE# #INDENT# primary . pop ( fname , None ) #NEWLINE# #UNINDENT# transforms = self . field_transforms . get ( self . primary_collection_name ) #NEWLINE# if transforms : #NEWLINE# #INDENT# primary = self . transform_fields ( primary , transforms ) #NEWLINE# #UNINDENT# for ( name , data ) in related . items ( ) : #NEWLINE# #INDENT# data . pop ( '_id' , None ) #NEWLINE# transforms = self . field_transforms . get ( name ) #NEWLINE# if transforms : #NEWLINE# #INDENT# data = self . transform_fields ( data , transforms ) #NEWLINE# #UNINDENT# flat . update ( data ) #NEWLINE# #UNINDENT# flat . update ( data ) #NEWLINE# flat . update ( self . get_calculated_fields ( flat ) ) #NEWLINE# return flat