summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2008-01-05 18:26:28 +0000
committerMike Bayer <mike_mp@zzzcomputing.com>2008-01-05 18:26:28 +0000
commite5b6c7bc334c52c22ae1c5199a802fa3649290cb (patch)
tree165100876949ad1af110c8cc21cc7d541fd892b3 /lib
parent9123a1d5ce6b016402296e4f7f7db49bb0fe3219 (diff)
downloadsqlalchemy-e5b6c7bc334c52c22ae1c5199a802fa3649290cb.tar.gz
- fixed fairly critical bug whereby the same instance could be listed
more than once in the unitofwork.new collection; most typically reproduced when using a combination of inheriting mappers and ScopedSession.mapper, as the multiple __init__ calls per instance could save() the object with distinct _state objects
Diffstat (limited to 'lib')
-rw-r--r--lib/sqlalchemy/orm/attributes.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/sqlalchemy/orm/attributes.py b/lib/sqlalchemy/orm/attributes.py
index 21b8a4e64..91bf13034 100644
--- a/lib/sqlalchemy/orm/attributes.py
+++ b/lib/sqlalchemy/orm/attributes.py
@@ -1122,7 +1122,8 @@ def register_class(class_, extra_init=None, on_exception=None, deferred_scalar_l
doinit = False
def init(instance, *args, **kwargs):
- instance._state = InstanceState(instance)
+ if not hasattr(instance, '_state'):
+ instance._state = InstanceState(instance)
if extra_init:
extra_init(class_, oldinit, instance, args, kwargs)