if self.prop._reverse_property:
return
- if not self.passive_updates:
- # for non-passive updates, register in the preprocess stage
- # so that mapper save_obj() gets a hold of changes
- unitofwork.GetDependentObjects(uow, self, False, False)
- else:
-
- ##### TODO ########
- # Get this out of here if self.parent.base_mapper isn't in the flush!!!!
-
- # for passive updates, register objects in the process stage
- # so that we avoid ManyToOneDP's registering the object without
- # the listonly flag in its own preprocess stage (results in UPDATE)
- # statements being emitted
- parent_saves = unitofwork.SaveUpdateAll(
- uow,
- self.parent.base_mapper)
- after_save = unitofwork.ProcessAll(uow, self, False, False)
- uow.dependencies.update([
- (parent_saves, after_save)
- ])
+ unitofwork.GetDependentObjects(uow, self, False, False)
def _has_flush_activity(self, uow):
pass
def presort_deletes(self, uowcommit, states):
assert False
- def presort_saves(self, uowcommit, states):
- assert not self.passive_updates
- self._process_key_switches(states, uowcommit)
+ def presort_saves(self, uow, states):
+ if self.passive_updates:
+ # for passive updates, register objects in the process stage
+ # so that we avoid ManyToOneDP's registering the object without
+ # the listonly flag in its own preprocess stage (results in UPDATE)
+ # statements being emitted
+ for s in states:
+ if self._pks_changed(uow, s):
+ parent_saves = unitofwork.SaveUpdateAll(
+ uow,
+ self.parent.base_mapper)
+ after_save = unitofwork.ProcessAll(uow, self, False, False)
+ uow.dependencies.update([
+ (parent_saves, after_save)
+ ])
+ return
+
+ else:
+ # for non-passive updates, register in the preprocess stage
+ # so that mapper save_obj() gets a hold of changes
+ self._process_key_switches(states, uow)
def process_deletes(self, uowcommit, states):
assert False
class ManyToManyDP(DependencyProcessor):
def per_property_flush_actions(self, uow):
- if self._check_reverse(uow):
- unitofwork.GetDependentObjects(uow, self, False, True)
- else:
- DependencyProcessor.per_property_flush_actions(self, uow)
-
- def _has_flush_activity(self, uow):
if self._check_reverse(uow):
return
- else:
- DependencyProcessor._has_flush_activity(self, uow)
-
- def per_state_flush_actions(self, uow, states, isdelete):
- if self._check_reverse(uow):
- return
- else:
- DependencyProcessor.\
- per_state_flush_actions(self, uow, states, isdelete)
-
+ DependencyProcessor.per_property_flush_actions(self, uow)
+
def per_property_dependencies(self, uow, parent_saves,
child_saves,
parent_deletes,
#sort = topological.sort(self.dependencies, postsort_actions)
#print "--------------"
#print self.dependencies
- #print postsort_actions
- #print "COUNT OF POSTSORT ACTIONS", len(postsort_actions)
+ print postsort_actions
+ print "COUNT OF POSTSORT ACTIONS", len(postsort_actions)
# execute
if self.cycles:
uow.deps[self.dependency_processor.parent.base_mapper].add(self.dependency_processor)
def execute(self, uow):
- states = list(self._elements(uow))
+ states = self._elements(uow)
if self.delete:
self.dependency_processor.process_deletes(uow, states)
else:
self.dependency_processor.process_saves(uow, states)
def per_state_flush_actions(self, uow):
- # we let the mappers call this,
- # so that a ProcessAll which is between two mappers that
- # are part of a cycle (but the ProcessAll itself is not
- # in the cycle), also becomes a per-state processor,
- # and a dependency between the two states as well
+ # this is handled by SaveUpdateAll and DeleteAll,
+ # since a ProcessAll should unconditionally be pulled
+ # into per-state if either the parent/child mappers
+ # are part of a cycle
return iter([])
class SaveUpdateAll(PostSortRec):