From 389325099d4d8c0ce42a5a0d5395fbe3ead15af5 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Mon, 22 Oct 2012 13:54:39 -0400 Subject: - 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. --- lib/sqlalchemy/orm/attributes.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'lib/sqlalchemy') 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), (), ()) -- cgit v1.2.1