]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
check for not enough inserted pks to backfill the object
authorMike Bayer <mike_mp@zzzcomputing.com>
Sun, 28 May 2006 16:37:22 +0000 (16:37 +0000)
committerMike Bayer <mike_mp@zzzcomputing.com>
Sun, 28 May 2006 16:37:22 +0000 (16:37 +0000)
lib/sqlalchemy/orm/mapper.py

index cdfbeb77c136356e4bb88854e6d9efb8f90c339c..3907b0b12ebebdfe7bcee169d2fb47d1a6b11027 100644 (file)
@@ -647,7 +647,7 @@ class Mapper(object):
                     if primary_key is not None:
                         i = 0
                         for col in self.pks_by_table[table]:
-                            if self._getattrbycolumn(obj, col) is None:
+                            if self._getattrbycolumn(obj, col) is None and len(primary_key) > i:
                                 self._setattrbycolumn(obj, col, primary_key[i])
                             i+=1
                     self._postfetch(connection, table, obj, c, c.last_inserted_params())