#NEWLINE# def serialize( self , obj , meteor_ids ) : #NEWLINE# #INDENT# 'Generate a DDP msg for obj with specified msg type.' #NEWLINE# exps = [ name for ( name , val ) in vars ( obj ) . items ( ) if isinstance ( val , ExpressionNode ) ] #NEWLINE# if exps : #NEWLINE# #INDENT# obj = deepcopy ( obj ) #NEWLINE# for ( name , val ) in self . model . objects . values ( * exps ) . get ( pk = obj . pk ) . items ( ) : #NEWLINE# #INDENT# setattr ( obj , name , val ) #NEWLINE# #UNINDENT# #UNINDENT# data = this . serializer . serialize ( [ obj ] ) [ 0 ] #NEWLINE# fields = data [ 'fields' ] #NEWLINE# del data [ 'pk' ] , data [ 'model' ] #NEWLINE# meta = self . model . _meta #NEWLINE# for field in meta . local_fields : #NEWLINE# #INDENT# rel = getattr ( field , 'rel' , None ) #NEWLINE# if rel : #NEWLINE# #INDENT# fields [ field . column ] = get_meteor_id ( getattr ( obj , field . name ) ) #NEWLINE# fields . pop ( field . name ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if isinstance ( field , django . contrib . postgres . fields . ArrayField ) : #NEWLINE# #INDENT# fields [ field . name ] = field . to_python ( fields . pop ( field . name ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( isinstance ( field , AleaIdField ) and ( not field . null ) and ( field . name == 'aid' ) ) : #NEWLINE# #INDENT# fields . pop ( field . name ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# for field in meta . local_many_to_many : #NEWLINE# #INDENT# fields [ ( '%s_ids' % field . name ) ] = get_meteor_ids ( field . rel . to , fields . pop ( field . name ) ) . values ( ) #NEWLINE# #UNINDENT# return data