From 5b23a6808041ff90e2097e2cb37188d4845828f4 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Sat, 22 Dec 2012 18:40:06 -0500 Subject: - add tests to ensure SELECT of dynamic collection not emitted on regular append/remove history - fix the real cause of the original #2637 issue, backrefs call upon the "pop()" method now which wasn't implemented for Dynamic --- lib/sqlalchemy/orm/attributes.py | 1 - lib/sqlalchemy/orm/dynamic.py | 3 +++ 2 files changed, 3 insertions(+), 1 deletion(-) (limited to 'lib/sqlalchemy') diff --git a/lib/sqlalchemy/orm/attributes.py b/lib/sqlalchemy/orm/attributes.py index 060eaa6e5..d2f20e94d 100644 --- a/lib/sqlalchemy/orm/attributes.py +++ b/lib/sqlalchemy/orm/attributes.py @@ -1030,7 +1030,6 @@ def backref_listeners(attribute, key, uselist): def emit_backref_from_scalar_set_event(state, child, oldchild, initiator): if oldchild is child: return child - if oldchild is not None and oldchild is not PASSIVE_NO_RESULT: # With lazy=None, there's no guarantee that the full collection is # present when updating via a backref. diff --git a/lib/sqlalchemy/orm/dynamic.py b/lib/sqlalchemy/orm/dynamic.py index c193f0e2a..3ab454a43 100644 --- a/lib/sqlalchemy/orm/dynamic.py +++ b/lib/sqlalchemy/orm/dynamic.py @@ -195,6 +195,9 @@ class DynamicAttributeImpl(attributes.AttributeImpl): if initiator is not self: self.fire_remove_event(state, dict_, value, initiator) + def pop(self, state, dict_, value, initiator, + passive=attributes.PASSIVE_OFF): + self.remove(state, dict_, value, initiator, passive=passive) class AppenderMixin(object): -- cgit v1.2.1