Closed
Description
Migrated issue, originally created by Michael Bayer (@zzzeek)
diff --git a/lib/sqlalchemy/orm/events.py b/lib/sqlalchemy/orm/events.py
index c50a7b0..bd0b48f 100644
--- a/lib/sqlalchemy/orm/events.py
+++ b/lib/sqlalchemy/orm/events.py
@@ -1490,7 +1490,7 @@ class AttributeEvents(event.Events):
@classmethod
def _listen(cls, event_key, active_history=False,
raw=False, retval=False,
- propagate=False):
+ propagate=False, **kw):
target, identifier, fn = \
event_key.dispatch_target, event_key.identifier, event_key.fn
@@ -1509,14 +1509,14 @@ class AttributeEvents(event.Events):
return fn(target, value, *arg)
event_key = event_key.with_wrapper(wrap)
- event_key.base_listen(propagate=propagate)
+ event_key.base_listen(propagate=propagate, **kw)
if propagate:
manager = instrumentation.manager_of_class(target.class_)
for mgr in manager.subclass_managers(True):
event_key.with_dispatch_target(
- mgr[target.key]).base_listen(propagate=True)
+ mgr[target.key]).base_listen(propagate=True, **kw)
def append(self, target, value, initiator):
"""Receive a collection append event.
from sqlalchemy import *
from sqlalchemy.orm import *
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import event
Base = declarative_base()
class A(Base):
__tablename__ = 'a'
id = Column(Integer, primary_key=True)
bs = relationship("B")
class B(Base):
__tablename__ = 'b'
id = Column(Integer, primary_key=True)
a_id = Column(Integer, ForeignKey('a.id'))
e = create_engine("sqlite://", echo=True)
sess = Session(e)
@event.listens_for(A.bs, 'set', named=True)
def update_challenge_points(target, **kw):
pass
Metadata
Metadata
Assignees
Labels
Type
Projects
Relationships
Development
No branches or pull requests
Activity
sqlalchemy-bot commentedon Sep 17, 2014
Changes by Michael Bayer (@zzzeek):
sqlalchemy-bot commentedon Sep 17, 2014
Changes by Michael Bayer (@zzzeek):
sqlalchemy-bot commentedon Sep 17, 2014
Changes by Michael Bayer (@zzzeek):
sqlalchemy-bot commentedon Sep 17, 2014
Michael Bayer (@zzzeek) wrote:
Issue #3201 was marked as a duplicate of this issue.
sqlalchemy-bot commentedon Sep 17, 2014
Michael Bayer (@zzzeek) wrote:
see #3201, same thing in engine reported at the same time, wacky!
sqlalchemy-bot commentedon Sep 18, 2014
Michael Bayer (@zzzeek) wrote:
as that of 🎫
3199
, when thenamed=True
parameterwould be used. Some events would fail to register, and others
would not invoke the event arguments correctly, generally in the
case of when an event was "wrapped" for adaption in some other way.
The "named" mechanics have been rearranged to not interfere with
the argument signature expected by internal wrapper functions.
fixes "named" is not accepted for attribute events, engine events #3197
→ b36cdef
sqlalchemy-bot commentedon Sep 18, 2014
Michael Bayer (@zzzeek) wrote:
as that of 🎫
3199
, when thenamed=True
parameterwould be used. Some events would fail to register, and others
would not invoke the event arguments correctly, generally in the
case of when an event was "wrapped" for adaption in some other way.
The "named" mechanics have been rearranged to not interfere with
the argument signature expected by internal wrapper functions.
fixes "named" is not accepted for attribute events, engine events #3197
Conflicts:
test/base/test_events.py
test/orm/test_attributes.py
test/orm/test_events.py
→ 912ebaa
sqlalchemy-bot commentedon Sep 18, 2014
Changes by Michael Bayer (@zzzeek):