summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/attributes.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2006-09-23 21:02:33 +0000
committerMike Bayer <mike_mp@zzzcomputing.com>2006-09-23 21:02:33 +0000
commit3e871d2755506f83fd314172df46909f7c58b462 (patch)
tree62cd1f3e0b4f73f9d4dc29008a128e3aee116291 /lib/sqlalchemy/attributes.py
parent7d74fc7785832ebd3bf39c9e42465e2d22b0c9e2 (diff)
downloadsqlalchemy-3e871d2755506f83fd314172df46909f7c58b462.tar.gz
- added "mutable" flag to PickleType, set to False to allow old (faster) behavior
- fix attribute unit test - attributes have explicit flag for "mutable_scalars", propigated by ColumnProperty
Diffstat (limited to 'lib/sqlalchemy/attributes.py')
-rw-r--r--lib/sqlalchemy/attributes.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/sqlalchemy/attributes.py b/lib/sqlalchemy/attributes.py
index 7fd9686e3..46c791bff 100644
--- a/lib/sqlalchemy/attributes.py
+++ b/lib/sqlalchemy/attributes.py
@@ -13,15 +13,15 @@ class InstrumentedAttribute(object):
PASSIVE_NORESULT = object()
- def __init__(self, manager, key, uselist, callable_, typecallable, trackparent=False, extension=None, copy_function=None, compare_function=None, **kwargs):
+ def __init__(self, manager, key, uselist, callable_, typecallable, trackparent=False, extension=None, copy_function=None, compare_function=None, mutable_scalars=False, **kwargs):
self.manager = manager
self.key = key
self.uselist = uselist
self.callable_ = callable_
self.typecallable= typecallable
self.trackparent = trackparent
+ self.mutable_scalars = mutable_scalars
if copy_function is None:
- self._check_mutable_modified = False
if uselist:
self._copyfunc = lambda x: [y for y in x]
else:
@@ -29,7 +29,6 @@ class InstrumentedAttribute(object):
# is passed
self._copyfunc = lambda x: x
else:
- self._check_mutable_modified = True
self._copyfunc = copy_function
if compare_function is None:
self._compare_function = lambda x,y: x == y
@@ -52,7 +51,7 @@ class InstrumentedAttribute(object):
return self._copyfunc(value)
def check_mutable_modified(self, obj):
- if self._check_mutable_modified:
+ if self.mutable_scalars:
h = self.get_history(obj, passive=True)
if h is not None and h.is_modified():
obj._state['modified'] = True