[sqlalchemy] AttributeEvents for mixin type classes

2011-10-04 Thread recurse
I'm having issues trying to add an event listener to a mixin class (which doesn't subclass Base) and wondering what kind of work-around there might be. It's probably easier to explain with an example ( http://paste.pocoo.org/show/487334/ ) Basically if I call event.listen(), and pass as a target

Re: [sqlalchemy] AttributeEvents for mixin type classes

2011-10-04 Thread Michael Bayer
The mixin by itself is not mapped so MyAddressMixin.address is just a Column object, not the InstrumentedAttribute which accepts the set event. So for this kind of thing you need to set up those events within an event of their own: from sqlalchemy.orm import mapper @event.listens_for(mapper,