summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/attributes.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2006-09-22 22:55:10 +0000
committerMike Bayer <mike_mp@zzzcomputing.com>2006-09-22 22:55:10 +0000
commit5b99ac8fc12b98ddb68eee208f0714be119c6895 (patch)
tree7fdb2d6ba70fe226e58c270e1a9613fbec4c3b6d /lib/sqlalchemy/attributes.py
parent8f540ba9928644c596275fd7a315e11af8ce6ec8 (diff)
downloadsqlalchemy-5b99ac8fc12b98ddb68eee208f0714be119c6895.tar.gz
fix to reset_class_managed to look at noninherited attributes only; an artifact of compilation brought this up
Diffstat (limited to 'lib/sqlalchemy/attributes.py')
-rw-r--r--lib/sqlalchemy/attributes.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/sqlalchemy/attributes.py b/lib/sqlalchemy/attributes.py
index af2c908c4..97e2ce7e4 100644
--- a/lib/sqlalchemy/attributes.py
+++ b/lib/sqlalchemy/attributes.py
@@ -612,6 +612,14 @@ class AttributeManager(object):
value = getattr(class_, key, None)
if isinstance(value, InstrumentedAttribute):
yield value
+
+ def noninherited_managed_attributes(self, class_):
+ if not isinstance(class_, type):
+ raise repr(class_) + " is not a type"
+ for key in class_.__dict__:
+ value = getattr(class_, key, None)
+ if isinstance(value, InstrumentedAttribute):
+ yield value
def is_modified(self, object):
return object._state.get('modified', False)
@@ -668,7 +676,7 @@ class AttributeManager(object):
def reset_class_managed(self, class_):
"""removes all InstrumentedAttribute property objects from the given class."""
- for attr in self.managed_attributes(class_):
+ for attr in self.noninherited_managed_attributes(class_):
delattr(class_, attr.key)
def is_class_managed(self, class_, key):
@@ -689,6 +697,7 @@ class AttributeManager(object):
def register_attribute(self, class_, key, uselist, callable_=None, **kwargs):
"""registers an attribute at the class level to be instrumented for all instances
of the class."""
+ #print "register attribute", key, "for class", class_
if not hasattr(class_, '_state'):
def _get_state(self):
try: