diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2012-10-22 13:54:39 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2012-10-22 13:54:39 -0400 |
commit | 389325099d4d8c0ce42a5a0d5395fbe3ead15af5 (patch) | |
tree | 3309f5260762d4ce0eda1fdea26e6e6d6807a733 /lib/sqlalchemy/orm/attributes.py | |
parent | 08a3d1c81c8c9242dc70521c60cf22cc5667d15a (diff) | |
download | sqlalchemy-389325099d4d8c0ce42a5a0d5395fbe3ead15af5.tar.gz |
- fix regression from 0.7 where calling get_history with passive
on a never-set collection would fail; made this act just like
scalars for now and added tests. I would think that HISTORY_BLANK
would be more appropriate here but it's too late in the game
to mess with that.
Diffstat (limited to 'lib/sqlalchemy/orm/attributes.py')
-rw-r--r-- | lib/sqlalchemy/orm/attributes.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/sqlalchemy/orm/attributes.py b/lib/sqlalchemy/orm/attributes.py index eec72b5f3..86da9a61d 100644 --- a/lib/sqlalchemy/orm/attributes.py +++ b/lib/sqlalchemy/orm/attributes.py @@ -1216,6 +1216,10 @@ class History(History): @classmethod def from_collection(cls, attribute, state, current): original = state.committed_state.get(attribute.key, _NO_HISTORY) + + if current is NO_VALUE or current is NEVER_SET: + return cls((), (), ()) + current = getattr(current, '_sa_adapter') if original is NO_VALUE: return cls(list(current), (), ()) |