#NEWLINE# def orm_item_locator( orm_obj ) : #NEWLINE# #INDENT# '\n    This function is called every time an object that will not be exported is required.\n    Where orm_obj is the referred object.\n    We postpone the lookup to locate_object() which will be run on the generated script\n\n    ' #NEWLINE# the_class = orm_obj . _meta . object_name #NEWLINE# original_class = the_class #NEWLINE# pk_name = orm_obj . _meta . pk . name #NEWLINE# original_pk_name = pk_name #NEWLINE# pk_value = getattr ( orm_obj , pk_name ) #NEWLINE# while ( hasattr ( pk_value , '_meta' ) and hasattr ( pk_value . _meta , 'pk' ) and hasattr ( pk_value . _meta . pk , 'name' ) ) : #NEWLINE# #INDENT# the_class = pk_value . _meta . object_name #NEWLINE# pk_name = pk_value . _meta . pk . name #NEWLINE# pk_value = getattr ( pk_value , orm_obj ) #NEWLINE# #UNINDENT# clean_dict = make_clean_dict ( orm_obj . __dict__ ) #NEWLINE# for key in clean_dict : #NEWLINE# #INDENT# v = clean_dict [ key ] #NEWLINE# if ( ( v is not None ) and ( not isinstance ( v , ( six . string_types , six . integer_types , float , datetime . datetime ) ) ) ) : #NEWLINE# #INDENT# clean_dict [ key ] = six . u ( ( '%s' % v ) ) #NEWLINE# #UNINDENT# #UNINDENT# output = ( ' importer.locate_object(%s, "%s", %s, "%s", %s, %s ) ' % ( original_class , original_pk_name , the_class , pk_name , pk_value , clean_dict ) ) #NEWLINE# return output