#uowcommit.register_task(self.mapper, True, self, self.parent, False)
else:
raise " no foreign key ?"
-
+
+ def get_object_dependencies(self, obj, uowcommit, passive = True):
+ """function to retreive the child list off of an object. "passive" means, if its
+ a lazy loaded list that is not loaded yet, dont load it."""
+ if self.uselist:
+ return uowcommit.uow.attributes.get_list_history(obj, self.key, passive = passive)
+ else:
+ return uowcommit.uow.attributes.get_history(obj, self.key)
+
def process_dependencies(self, deplist, uowcommit, delete = False):
print self.mapper.table.name + " " + repr(deplist.map.values()) + " process_dep isdelete " + repr(delete)
-
- # function to retreive the child list off of an object. "passive" means, if its
- # a lazy loaded list that is not loaded yet, dont load it.
- def getlist(obj, passive = True):
- if self.uselist:
- return uowcommit.uow.attributes.get_list_history(obj, self.key, passive = passive)
- else:
- return uowcommit.uow.attributes.get_history(obj, self.key)
# fucntion to set properties across a parent/child object plus an "association row",
# based on a join condition
self._sync_foreign_keys(binary, obj, child, associationrow, clearkeys)
setter = BinaryVisitor(sync_foreign_keys)
+ def getlist(obj, passive=True):
+ return self.get_object_dependencies(obj, uowcommit, passive)
+
associationrow = {}
# plugin point
processor.process_dependencies(targettask.objects, trans, delete = self.isdelete)
if not self.listonly and self.isdelete:
self.mapper.delete_obj(obj_list, trans)
+
+ def sort_circular_dependencies(self):
+ d = {}
+ head = None
+ for obj in obj_list:
+ d[obj] = UOWTask(self.mapper, self.isdelete, self.listonly)
+ d[obj].dependencies = self.dependencies
+ if head is None:
+ head = obj
+ for dep in self.dependencies:
+ (processor, targettask) = dep
+ if targetttask is self:
+ for o in processor.get_object_dependencies(obj, self, passive = True):
+ if o is head:
+ head = obj
+ d[obj].objects.append(o)
+ if head is None:
+ return self
+ else:
+ return d[head]
def __str__(self):
if self.isdelete: