[Sqlalchemy-tickets] Issue #2973: Event removal not working (zzzeek/sqlalchemy)
Brought to you by:
zzzeek
From: Konsta V. <iss...@bi...> - 2014-02-25 21:05:09
|
New issue 2973: Event removal not working https://bitbucket.org/zzzeek/sqlalchemy/issue/2973/event-removal-not-working Konsta Vesterinen: Very simple test scenario: ``` #!python import sqlalchemy as sa @sa.event.listens_for(sa.orm.mapper, 'instrument_class') def my_listener(mapper, cls): pass sa.event.remove( sa.orm.mapper, 'instrument_class', my_listener ) ``` This throws a ValueError: ``` #!python def remove(self, event_key): target = event_key.dispatch_target stack = [target] while stack: cls = stack.pop(0) stack.extend(cls.__subclasses__()) if cls in self._clslevel: > self._clslevel[cls].remove(event_key.fn) E ValueError: list.remove(x): x not in list ``` Maybe the `event_key.fn` should be `event_key.fn_wrap` instead? |