summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/attributes.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2006-03-26 21:44:22 +0000
committerMike Bayer <mike_mp@zzzcomputing.com>2006-03-26 21:44:22 +0000
commitcb3be7803bd2d8071ead35d5f053c90f706a678b (patch)
treec2412d863c4f07b149d41a863b02f1f26dcc0925 /lib/sqlalchemy/attributes.py
parentc0775bdadc0ad37b7823379c5ab03df98b63da44 (diff)
downloadsqlalchemy-cb3be7803bd2d8071ead35d5f053c90f706a678b.tar.gz
rework to expire() to make it smarter. when you expire(), history is immediately removed as well as explicit from dirty/deleted lists. this also changes uow.rollback_object() to remove from those lists, which is strange that it didnt do that before. anyway the mapper, when selecting and creating instances, asks the uow if this already identity-mapped instance is expired, and if so refreshes it on the fly, saving the need for the re-_get() operation, if some other query happens to touch upon the expired object. unit test added to confirm this.
Diffstat (limited to 'lib/sqlalchemy/attributes.py')
-rw-r--r--lib/sqlalchemy/attributes.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/sqlalchemy/attributes.py b/lib/sqlalchemy/attributes.py
index cd01faddd..a5661ac5a 100644
--- a/lib/sqlalchemy/attributes.py
+++ b/lib/sqlalchemy/attributes.py
@@ -398,7 +398,13 @@ class AttributeManager(object):
except KeyError:
pass
obj.__dict__['_managed_trigger'] = callable
+
+ def untrigger_history(self, obj):
+ del obj.__dict__['_managed_trigger']
+ def has_trigger(self, obj):
+ return obj.__dict__.has_key('_managed_trigger')
+
def reset_history(self, obj, key):
"""removes the history object for the given attribute on the given object.
When the attribute is next accessed, a new container will be created via the