diff options
Diffstat (limited to 'lib/sqlalchemy')
-rw-r--r-- | lib/sqlalchemy/orm/dependency.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/sqlalchemy/orm/dependency.py b/lib/sqlalchemy/orm/dependency.py index 0c0dacd20..54b043b32 100644 --- a/lib/sqlalchemy/orm/dependency.py +++ b/lib/sqlalchemy/orm/dependency.py @@ -338,7 +338,7 @@ class ManyToManyDP(DependencyProcessor): childlist = self.get_object_dependencies(obj, uowcommit, passive=self.passive_deletes) if childlist is not None: for child in childlist.deleted_items() + childlist.unchanged_items(): - if reverse_dep and (reverse_dep, "manytomany", child, obj) in uowcommit.attributes: + if child is None or (reverse_dep and (reverse_dep, "manytomany", child, obj) in uowcommit.attributes): continue associationrow = {} self._synchronize(obj, child, associationrow, False, uowcommit) @@ -349,14 +349,14 @@ class ManyToManyDP(DependencyProcessor): childlist = self.get_object_dependencies(obj, uowcommit) if childlist is None: continue for child in childlist.added_items(): - if reverse_dep and (reverse_dep, "manytomany", child, obj) in uowcommit.attributes: + if child is None or (reverse_dep and (reverse_dep, "manytomany", child, obj) in uowcommit.attributes): continue associationrow = {} self._synchronize(obj, child, associationrow, False, uowcommit) uowcommit.attributes[(self, "manytomany", obj, child)] = True secondary_insert.append(associationrow) for child in childlist.deleted_items(): - if reverse_dep and (reverse_dep, "manytomany", child, obj) in uowcommit.attributes: + if child is None or (reverse_dep and (reverse_dep, "manytomany", child, obj) in uowcommit.attributes): continue associationrow = {} self._synchronize(obj, child, associationrow, False, uowcommit) |