From: Mike Bayer Date: Sat, 17 Dec 2005 19:43:11 +0000 (+0000) Subject: need to do before_insert before populating the insert row X-Git-Tag: rel_0_1_0~228 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=701e388037fe4de0ccf2894b3171f8fafa949375;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git need to do before_insert before populating the insert row --- diff --git a/lib/sqlalchemy/mapping/mapper.py b/lib/sqlalchemy/mapping/mapper.py index cfa373e0ae..69cde4d791 100644 --- a/lib/sqlalchemy/mapping/mapper.py +++ b/lib/sqlalchemy/mapping/mapper.py @@ -442,6 +442,9 @@ class Mapper(object): # print "SAVE_OBJ we are " + hash_key(self) + " obj: " + obj.__class__.__name__ + repr(id(obj)) params = {} + if not hasattr(obj, "_instance_key"): + self.extension.before_insert(self, obj) + for col in table.columns: #if col.primary_key: if pk.has_key(col): @@ -459,7 +462,6 @@ class Mapper(object): if hasattr(obj, "_instance_key"): update.append(params) else: - self.extension.before_insert(self, obj) insert.append((obj, params)) uow.register_saved_object(obj) if len(update):