On Sep 15, 2014, at 3:58 AM, Florian Rüchel <[email protected]> wrote:
> Hi, > > I use events for some of my models to trigger changes and so on. However, one > function needs to be triggered on very different events (attribute, mapper). > To make things easy, I wanted to use named arguments and implement the > correct logic to retrieve the values I needed. However, when I tried to use > it, I get below traceback: > > File "[...]/lib/python2.7/site-packages/sqlalchemy/event/api.py", line 94, > in decorate > listen(target, identifier, fn, *args, **kw) > File "[...]/lib/python2.7/site-packages/sqlalchemy/event/api.py", line 63, > in listen > _event_key(target, identifier, fn).listen(*args, **kw) > File "[...]/lib/python2.7/site-packages/sqlalchemy/event/registry.py", line > 187, in listen > self.dispatch_target.dispatch._listen(self, *args, **kw) > TypeError: _listen() got an unexpected keyword argument 'named' > > My version is 0.9.7, verified both with pip freeze and by importing > sqlalchemy and checking __version__. Everything runs in a virtualenv. > > Here is the relevant code I use: > > @event.listens_for(Model.my_attr, 'set', named=True) > def update_challenge_points(target, **kw): > pass > > I don't know why this exception is triggered and cannot find anything on > google... I appreciate any help you can offer. this is a bug, https://bitbucket.org/zzzeek/sqlalchemy/issue/3197/named-is-not-accepted-for-attribute-events, we'll have it fixed for 0.9.8. obviously you can't use named for now for that particular event. -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout.
