]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
(no commit message)
authorMike Bayer <mike_mp@zzzcomputing.com>
Tue, 13 Sep 2005 07:44:33 +0000 (07:44 +0000)
committerMike Bayer <mike_mp@zzzcomputing.com>
Tue, 13 Sep 2005 07:44:33 +0000 (07:44 +0000)
lib/sqlalchemy/mapper.py

index 9b3106b9a9bc5c16881c29b556c219ee13eac9aa..141a990694a52880fac158dcc55e9ecb69d1454d 100644 (file)
@@ -170,7 +170,6 @@ class Mapper(object):
 
     def put(self, instance):
         key = objectstore.get_instance_key(instance, self.class_, self.table, self.selectable)
-        instance._instance_key = key
         objectstore.put(key, instance, self.scope)
         return key
 
@@ -217,18 +216,18 @@ class Mapper(object):
     def save_obj(self, obj):
         # TODO: start breaking down the individual updates/inserts into the UOW or something,
         # so they can be combined into a multiple execute
+        if hasattr(obj, "_instance_key"):
+            isinsert = False
+        else:
+            isinsert = True
+
         for table in self.tables:
             params = {}
-            if hasattr(obj, "_instance_key"):
-                isinsert = False
-            else:
-                isinsert = True
                 
             needs_primaries = False
             for primary_key in table.primary_keys:
                 if self._getattrbycolumn(obj, primary_key) is None:
                     needs_primaries = True
-                    #statement = table.insert()
                 if isinsert:
                     for col in table.columns:
                         params[col.key] = self._getattrbycolumn(obj, col)
@@ -240,7 +239,6 @@ class Mapper(object):
                         clause.clauses.append(col == self._getattrbycolumn(obj, col))
                     else:
                         params[col.key] = self._getattrbycolumn(obj, col)
-                #statement = table.update(clause)
 
             if not isinsert:
                 statement = table.update(clause)
@@ -257,7 +255,7 @@ class Mapper(object):
                     newid = primary_keys[index]
                     index += 1
                     self._setattrbycolumn(obj, col, newid)
-                self.put(obj)
+                #self.put(obj)
 
     def register_dependencies(self, obj, uow):
         for prop in self.props.values():