summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/orm/unitofwork.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2011-02-11 15:37:44 -0500
committerMike Bayer <mike_mp@zzzcomputing.com>2011-02-11 15:37:44 -0500
commitad9b85fa8e751f5bfc8c27705e86898131dbc62e (patch)
tree4cd8ce603a146413c276b061d3b6c7de1ed429ad /lib/sqlalchemy/orm/unitofwork.py
parentd7fda4ae03f0e1c1ab73ced15e7b0472f36d1024 (diff)
downloadsqlalchemy-ad9b85fa8e751f5bfc8c27705e86898131dbc62e.tar.gz
- replace all usage of True and False for passive with PASSIVE_NO_INITIALIZE,
PASSIVE_OFF, now expresed as non-boolean symbols - make "passive" available positionally on all get_history() methods, call it like that
Diffstat (limited to 'lib/sqlalchemy/orm/unitofwork.py')
-rw-r--r--lib/sqlalchemy/orm/unitofwork.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/sqlalchemy/orm/unitofwork.py b/lib/sqlalchemy/orm/unitofwork.py
index 07c9c2b6d..5e0c93938 100644
--- a/lib/sqlalchemy/orm/unitofwork.py
+++ b/lib/sqlalchemy/orm/unitofwork.py
@@ -149,7 +149,8 @@ class UOWTransaction(object):
self.states[state] = (isdelete, True)
- def get_attribute_history(self, state, key, passive=attributes.PASSIVE_NO_INITIALIZE):
+ def get_attribute_history(self, state, key,
+ passive=attributes.PASSIVE_NO_INITIALIZE):
"""facade to attributes.get_state_history(), including caching of results."""
hashkey = ("history", state, key)
@@ -162,9 +163,11 @@ class UOWTransaction(object):
history, state_history, 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
- if cached_passive and not passive:
+ if cached_passive is not attributes.PASSIVE_OFF \
+ and passive is attributes.PASSIVE_OFF:
impl = state.manager[key].impl
- history = impl.get_history(state, state.dict, passive=False)
+ history = impl.get_history(state, state.dict,
+ attributes.PASSIVE_OFF)
if history and impl.uses_objects:
state_history = history.as_state()
else:
@@ -174,7 +177,7 @@ class UOWTransaction(object):
impl = state.manager[key].impl
# TODO: store the history as (state, object) tuples
# so we don't have to keep converting here
- history = impl.get_history(state, state.dict, passive=passive)
+ history = impl.get_history(state, state.dict, passive)
if history and impl.uses_objects:
state_history = history.as_state()
else: