]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
mapper uses attributes to get non-cached history
authorMike Bayer <mike_mp@zzzcomputing.com>
Sun, 9 Dec 2007 05:24:07 +0000 (05:24 +0000)
committerMike Bayer <mike_mp@zzzcomputing.com>
Sun, 9 Dec 2007 05:24:07 +0000 (05:24 +0000)
lib/sqlalchemy/orm/mapper.py
lib/sqlalchemy/orm/unitofwork.py

index f5e38c1c450413d9cf0ae15ab150697a319018ba..8386abb9ff69cd531c1c50eae20e853cc0a71315 100644 (file)
@@ -998,9 +998,6 @@ class Mapper(object):
                 if self.__should_log_debug:
                     self.__log_debug("detected row switch for identity %s.  will update %s, remove %s from transaction" % (instance_key, mapperutil.state_str(state), mapperutil.instance_str(existing)))
                 uowtransaction.set_row_switch(existing)
-#            if _state_has_identity(state):
-#                if state.dict['_instance_key'] != instance_key:
-#                    raise exceptions.FlushError("Can't change the identity of instance %s in session (existing identity: %s; new identity: %s)" % (mapperutil.state_str(state), state.dict['_instance_key'], instance_key))
 
         inserted_objects = util.Set()
         updated_objects = util.Set()
@@ -1070,8 +1067,7 @@ class Mapper(object):
                                 continue
                                 
                             prop = mapper._columntoproperty[col]
-                            (added, unchanged, deleted) = uowtransaction.get_attribute_history(state, prop.key, passive=True, cache=False)
-                            #(added, unchanged, deleted) = attributes.get_history(state, prop.key, passive=True)
+                            (added, unchanged, deleted) = attributes.get_history(state, prop.key, passive=True)
                             if added:
                                 if isinstance(added[0], sql.ClauseElement):
                                     value_params[col] = added[0]
index 19642cc9d15a36a159474c2f5a06c50668fef34f..a6bf8df901ddac06beef19d4d11b29deab71cbbf 100644 (file)
@@ -280,13 +280,13 @@ class UOWTransaction(object):
 
         self.logger = logging.instance_logger(self, echoflag=session.echo_uow)
 
-    def get_attribute_history(self, state, key, passive=True, cache=True):
+    def get_attribute_history(self, state, key, passive=True):
         hashkey = ("history", state, key)
 
         # cache the objects, not the states; the strong reference here
         # prevents newly loaded objects from being dereferenced during the 
         # flush process
-        if cache and hashkey in self.attributes:
+        if hashkey in self.attributes:
             (added, unchanged, deleted, cached_passive) = self.attributes[hashkey]
             # if the cached lookup was "passive" and now we want non-passive, do a non-passive
             # lookup and re-cache