#NEWLINE# def presort_saves( self , uowcommit , states ) : #NEWLINE# #INDENT# children_added = uowcommit . memo ( ( 'children_added' , self ) , set ) #NEWLINE# for state in states : #NEWLINE# #INDENT# pks_changed = self . _pks_changed ( uowcommit , state ) #NEWLINE# if ( ( not pks_changed ) or self . passive_updates ) : #NEWLINE# #INDENT# passive = attributes . PASSIVE_NO_INITIALIZE #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# passive = attributes . PASSIVE_OFF #NEWLINE# #UNINDENT# history = uowcommit . get_attribute_history ( state , self . key , passive ) #NEWLINE# if history : #NEWLINE# #INDENT# for child in history . added : #NEWLINE# #INDENT# if ( child is not None ) : #NEWLINE# #INDENT# uowcommit . register_object ( child , cancel_delete = True , operation = 'add' , prop = self . prop ) #NEWLINE# #UNINDENT# #UNINDENT# children_added . update ( history . added ) #NEWLINE# for child in history . deleted : #NEWLINE# #INDENT# if ( not self . cascade . delete_orphan ) : #NEWLINE# #INDENT# uowcommit . register_object ( child , isdelete = False , operation = 'delete' , prop = self . prop ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( self . hasparent ( child ) is False ) : #NEWLINE# #INDENT# uowcommit . register_object ( child , isdelete = True , operation = 'delete' , prop = self . prop ) #NEWLINE# for ( c , m , st_ , dct_ ) in self . mapper . cascade_iterator ( 'delete' , child ) : #NEWLINE# #INDENT# uowcommit . register_object ( st_ , isdelete = True ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# if pks_changed : #NEWLINE# #INDENT# if history : #NEWLINE# #INDENT# for child in history . unchanged : #NEWLINE# #INDENT# if ( child is not None ) : #NEWLINE# #INDENT# uowcommit . register_object ( child , False , self . passive_updates , operation = 'pk change' , prop = self . prop )