def preprocess_dependencies(self, task, deplist, uowcommit, delete = False):
        #print self.mapper.mapped_table.name + " " + self.key + " " + repr(len(deplist)) + " preprocess_dep isdelete " + repr(delete) + " direction " + repr(self.direction)

        if delete:
            # head object is being deleted, and we manage its list of child objects
            # the child objects have to have their foreign key to the parent set to NULL
            if not self.post_update:
                should_null_fks = not self.cascade.delete and not self.passive_deletes=='all'
                for state in deplist:
                    (added, unchanged, deleted) = uowcommit.get_attribute_history(state, self.key,passive=self.passive_deletes)
                    if unchanged or deleted:
                        for child in deleted:
                            if child is not None and self.hasparent(child) is False:
                                if self.cascade.delete_orphan:
                                    uowcommit.register_object(child, isdelete=True)
                                else:
                                    uowcommit.register_object(child)
                        if should_null_fks:
                            for child in unchanged:
                                if child is not None:
                                    uowcommit.register_object(child)
        else:
            for state in deplist:
                (added, unchanged, deleted) = uowcommit.get_attribute_history(state, self.key,passive=True)
                if added or deleted:
                    for child in added:
                        if child is not None:
                            uowcommit.register_object(child)
                    for child in deleted:
                        if not self.cascade.delete_orphan:
                            uowcommit.register_object(child, isdelete=False)
                        elif self.hasparent(child) is False:
                            uowcommit.register_object(child, isdelete=True)
                            for c, m in self.mapper.cascade_iterator('delete', child):
                                uowcommit.register_object(c._state, isdelete=True)
                if not self.passive_updates and self._pks_changed(uowcommit, state):
                    if not unchanged:
                        (added, unchanged, deleted) = uowcommit.get_attribute_history(state, self.key, passive=False)
                    if unchanged:
                        for child in unchanged:
                            uowcommit.register_object(child)