From: Mike Bayer Date: Sat, 4 Feb 2006 17:31:38 +0000 (+0000) Subject: fixes involving when child object from list items is None - onetoone must pass, objec... X-Git-Tag: rel_0_1_0~66 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5acfc561519807a856bb96dfb75edd33c56c39be;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git fixes involving when child object from list items is None - onetoone must pass, objectstore.testbackwardsmanipulations with postgres passes --- 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