#NEWLINE# def iterator( self ) : #NEWLINE# #INDENT# '\n        An iterator over the results from applying this QuerySet to the\n        remote web service.\n        ' #NEWLINE# try : #NEWLINE# #INDENT# ( sql , params ) = SQLCompiler ( self . query , connections [ self . db ] , None ) . as_sql ( ) #NEWLINE# #UNINDENT# except EmptyResultSet : #NEWLINE# #INDENT# raise StopIteration #NEWLINE# #UNINDENT# cursor = CursorWrapper ( connections [ self . db ] , self . query ) #NEWLINE# cursor . execute ( sql , params ) #NEWLINE# pfd = prep_for_deserialize #NEWLINE# only_load = self . query . get_loaded_field_names ( ) #NEWLINE# load_fields = [ ] #NEWLINE# if ( not only_load ) : #NEWLINE# #INDENT# model_cls = self . model #NEWLINE# init_list = None #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# fields = self . model . _meta . concrete_fields #NEWLINE# for field in fields : #NEWLINE# #INDENT# model = field . model . _meta . concrete_model #NEWLINE# if ( model is None ) : #NEWLINE# #INDENT# model = self . model #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# selected_name = ( field . attname if DJANGO_18_PLUS else field . name ) #NEWLINE# if ( selected_name in only_load [ model ] ) : #NEWLINE# #INDENT# load_fields . append ( field . name ) #NEWLINE# #UNINDENT# #UNINDENT# except KeyError : #NEWLINE# #INDENT# load_fields . append ( field . name ) #NEWLINE# #UNINDENT# #UNINDENT# init_list = [ ] #NEWLINE# skip = set ( ) #NEWLINE# for field in fields : #NEWLINE# #INDENT# if ( field . name not in load_fields ) : #NEWLINE# #INDENT# skip . add ( field . attname ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# init_list . append ( field . name ) #NEWLINE# #UNINDENT# #UNINDENT# model_cls = deferred_class_factory ( self . model , skip ) #NEWLINE# #UNINDENT# field_names = self . query . get_loaded_field_names ( ) #NEWLINE# for res in python . Deserializer ( ( pfd ( model_cls , r , self . db , init_list ) for r in cursor . results ) ) : #NEWLINE# #INDENT# res . object . _state . db = self . db #NEWLINE# res . object . _state . adding = False #NEWLINE# ( yield res . object )