summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/attributes.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2006-10-05 01:39:44 +0000
committerMike Bayer <mike_mp@zzzcomputing.com>2006-10-05 01:39:44 +0000
commit8b1afef6e92199691f250213042166bfcbd5d024 (patch)
tree3e56cbdeaa402c80336e0dc10319831304f51c94 /lib/sqlalchemy/attributes.py
parentf61cd50128cd5b1f996c68927b0af6ed9e434ea4 (diff)
downloadsqlalchemy-8b1afef6e92199691f250213042166bfcbd5d024.tar.gz
[ticket:324]
Diffstat (limited to 'lib/sqlalchemy/attributes.py')
-rw-r--r--lib/sqlalchemy/attributes.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/sqlalchemy/attributes.py b/lib/sqlalchemy/attributes.py
index 388c10bce..67c23ba95 100644
--- a/lib/sqlalchemy/attributes.py
+++ b/lib/sqlalchemy/attributes.py
@@ -508,19 +508,21 @@ class GenericBackrefExtension(AttributeExtension):
class CommittedState(object):
"""stores the original state of an object when the commit() method on the attribute manager
is called."""
+ NO_VALUE = object()
+
def __init__(self, manager, obj):
self.data = {}
for attr in manager.managed_attributes(obj.__class__):
self.commit_attribute(attr, obj)
- def commit_attribute(self, attr, obj, value=False):
+ def commit_attribute(self, attr, obj, value=NO_VALUE):
"""establish the value of attribute 'attr' on instance 'obj' as "committed".
this corresponds to a previously saved state being restored. """
- if value is False:
+ if value is CommittedState.NO_VALUE:
if obj.__dict__.has_key(attr.key):
value = obj.__dict__[attr.key]
- if value is not False:
+ if value is not CommittedState.NO_VALUE:
self.data[attr.key] = attr.copy(value)
# not tracking parent on lazy-loaded instances at the moment.