else:
uowcommit.register_dependency(self.mapper, self.parent)
uowcommit.register_processor(self.mapper, self, self.parent, False)
+ uowcommit.register_processor(self.mapper, self, self.parent, True)
else:
raise AssertionError(" no foreign key ?")
statement = self.secondary.insert()
statement.execute(*secondary_insert)
elif self.direction == PropertyLoader.MANYTOONE and delete:
- if self.post_update:
+ if self.private:
+ for obj in deplist:
+ childlist = getlist(obj, False)
+ for child in childlist.deleted_items() + childlist.unchanged_items():
+ uowcommit.register_object(child, isdelete=True)
+ elif self.post_update:
# post_update means we have to update our row to not reference the child object
# before we can DELETE the row
for obj in deplist:
# the child objects have to have their foreign key to the parent set to NULL
if self.private and not self.post_update:
# if we are privately managed, then all our objects should
- # have been marked as "todelete" already and no attribute adjustment is needed
- return
- for obj in deplist:
- childlist = getlist(obj, False)
- for child in childlist.deleted_items() + childlist.unchanged_items():
- if child is not None:
- self._synchronize(obj, child, None, True)
- uowcommit.register_object(child, postupdate=self.post_update)
+ # have been marked as "todelete" already and no attribute adjustment is needed.
+ # however, if they say objectstore.commit(x), i.e. on an individual object,
+ # then this extra step is more important.
+ for obj in deplist:
+ childlist = getlist(obj, False)
+ for child in childlist.deleted_items() + childlist.unchanged_items():
+ uowcommit.register_object(child, isdelete=True)
+ else:
+ for obj in deplist:
+ childlist = getlist(obj, False)
+ for child in childlist.deleted_items() + childlist.unchanged_items():
+ if child is not None:
+ self._synchronize(obj, child, None, True)
+ uowcommit.register_object(child, postupdate=self.post_update)
elif self.association is not None:
# manage association objects.
for obj in deplist: