From 5acfc561519807a856bb96dfb75edd33c56c39be Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Sat, 4 Feb 2006 17:31:38 +0000 Subject: [PATCH] fixes involving when child object from list items is None - onetoone must pass, objectstore.testbackwardsmanipulations with postgres passes --- lib/sqlalchemy/mapping/properties.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/sqlalchemy/mapping/properties.py b/lib/sqlalchemy/mapping/properties.py index 9eb97aa0c1..a58db251f0 100644 --- a/lib/sqlalchemy/mapping/properties.py +++ b/lib/sqlalchemy/mapping/properties.py @@ -516,11 +516,10 @@ class PropertyLoader(MapperProperty): childlist = getlist(obj, passive=True) if childlist is None: continue for child in childlist.added_items(): - if child is not None: - self._synchronize(obj, child, None, False) - if self.direction == PropertyLoader.ONETOMANY: - # for a cyclical task, this registration is handled by the objectstore - uowcommit.register_object(child) + self._synchronize(obj, child, None, False) + if self.direction == PropertyLoader.ONETOMANY and child is not None: + # for a cyclical task, this registration is handled by the objectstore + uowcommit.register_object(child) if self.direction != PropertyLoader.MANYTOONE or len(childlist.added_items()) == 0: for child in childlist.deleted_items(): if not self.private: @@ -540,6 +539,9 @@ class PropertyLoader(MapperProperty): source = None dest = associationrow + if dest is None: + return + for rule in self.syncrules: localsource = source (smapper, scol, dmapper, dcol) = rule -- 2.47.2