From: Mike Bayer Date: Sun, 28 May 2006 16:37:22 +0000 (+0000) Subject: check for not enough inserted pks to backfill the object X-Git-Tag: rel_0_2_1~12 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b62451e321574f4a39ac0deee01f42c5846b2d38;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git check for not enough inserted pks to backfill the object --- diff --git a/lib/sqlalchemy/orm/mapper.py b/lib/sqlalchemy/orm/mapper.py index cdfbeb77c1..3907b0b12e 100644 --- a/lib/sqlalchemy/orm/mapper.py +++ b/lib/sqlalchemy/orm/mapper.py @@ -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())