diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2012-04-23 11:45:06 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2012-04-23 11:45:06 -0400 |
commit | ff0fb31bf205a82c4af8781ac9afc96586a67d66 (patch) | |
tree | 95d3d6164cdfe6104cdde2cb94daab11ec4da17c /lib/sqlalchemy/orm/dynamic.py | |
parent | 713a4e19fa6c4397191dd7311152c6c69c37535e (diff) | |
download | sqlalchemy-ff0fb31bf205a82c4af8781ac9afc96586a67d66.tar.gz |
- merge attribute flag overhaul for [ticket:2358]
Diffstat (limited to 'lib/sqlalchemy/orm/dynamic.py')
-rw-r--r-- | lib/sqlalchemy/orm/dynamic.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/sqlalchemy/orm/dynamic.py b/lib/sqlalchemy/orm/dynamic.py index edf052870..1a3e52a36 100644 --- a/lib/sqlalchemy/orm/dynamic.py +++ b/lib/sqlalchemy/orm/dynamic.py @@ -57,7 +57,7 @@ class DynamicAttributeImpl(attributes.AttributeImpl): self.query_class = mixin_user_query(query_class) def get(self, state, dict_, passive=attributes.PASSIVE_OFF): - if passive is not attributes.PASSIVE_OFF: + if not passive & attributes.SQL_OK: return self._get_collection_history(state, attributes.PASSIVE_NO_INITIALIZE).added_items else: @@ -65,7 +65,7 @@ class DynamicAttributeImpl(attributes.AttributeImpl): def get_collection(self, state, dict_, user_data=None, passive=attributes.PASSIVE_NO_INITIALIZE): - if passive is not attributes.PASSIVE_OFF: + if not passive & attributes.SQL_OK: return self._get_collection_history(state, passive).added_items else: @@ -142,7 +142,7 @@ class DynamicAttributeImpl(attributes.AttributeImpl): c.deleted_items) def get_all_pending(self, state, dict_): - c = self._get_collection_history(state, True) + c = self._get_collection_history(state, attributes.PASSIVE_NO_INITIALIZE) return [ (attributes.instance_state(x), x) for x in @@ -155,7 +155,9 @@ class DynamicAttributeImpl(attributes.AttributeImpl): else: c = CollectionHistory(self, state) - if passive is attributes.PASSIVE_OFF: + # TODO: consider using a different flag here, possibly + # one local to dynamic + if passive & attributes.INIT_OK: return CollectionHistory(self, state, apply_to=c) else: return c |