diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2006-03-27 02:02:06 +0000 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2006-03-27 02:02:06 +0000 |
commit | 6698e1ab449042f56a1c1db98043d77a62f8ef08 (patch) | |
tree | a0a40aafde0c51f457ad9550a73c1df8d51c9fd3 /lib/sqlalchemy/mapping | |
parent | a632fa119117ef7e19ac2b682a65078c8db715f7 (diff) | |
download | sqlalchemy-6698e1ab449042f56a1c1db98043d77a62f8ef08.tar.gz |
backrefs on cyclical relationships were breaking for the "root" node which had None for a parent, due to addition in [changeset:1186] which added a "deletion" traversal for many-to-one relationships. added unittest.
Diffstat (limited to 'lib/sqlalchemy/mapping')
-rw-r--r-- | lib/sqlalchemy/mapping/properties.py | 3 | ||||
-rw-r--r-- | lib/sqlalchemy/mapping/unitofwork.py | 4 |
2 files changed, 7 insertions, 0 deletions
diff --git a/lib/sqlalchemy/mapping/properties.py b/lib/sqlalchemy/mapping/properties.py index 10d6472f4..b18d4d54f 100644 --- a/lib/sqlalchemy/mapping/properties.py +++ b/lib/sqlalchemy/mapping/properties.py @@ -382,6 +382,9 @@ class PropertyLoader(MapperProperty): else: uowcommit.register_dependency(self.mapper, self.parent) uowcommit.register_processor(self.mapper, self, self.parent, False) + # this dependency processor is used to locate "private" child objects + # during a "delete" operation, when the objectstore is being committed + # with only a partial list of objects uowcommit.register_processor(self.mapper, self, self.parent, True) else: raise AssertionError(" no foreign key ?") diff --git a/lib/sqlalchemy/mapping/unitofwork.py b/lib/sqlalchemy/mapping/unitofwork.py index 0b392b447..1eea546df 100644 --- a/lib/sqlalchemy/mapping/unitofwork.py +++ b/lib/sqlalchemy/mapping/unitofwork.py @@ -647,6 +647,10 @@ class UOWTask(object): childlist = childlist.added_items() for o in childlist: + if o is None: + # this can be None due to the many-to-one dependency processor added + # for deleted items, line 385 properties.py + continue if not o in childtask.objects: # item needs to be saved since its added, or attached to a deleted object childtask.append(o, isdelete=isdelete and dep.processor.private) |