]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
fixes involving when child object from list items is None - onetoone must pass, objec...
authorMike Bayer <mike_mp@zzzcomputing.com>
Sat, 4 Feb 2006 17:31:38 +0000 (17:31 +0000)
committerMike Bayer <mike_mp@zzzcomputing.com>
Sat, 4 Feb 2006 17:31:38 +0000 (17:31 +0000)
lib/sqlalchemy/mapping/properties.py

index 9eb97aa0c1afe17fc08bdea8cdc3beedd569d798..a58db251f06e4cb338f611fb6c981f33b934cf3c 100644 (file)
@@ -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