[sqlalchemy] Acting on creation of model instances

2010-05-26 Thread Dan Ellis
I've only found partial answers to this problem so far, so I'd like to expand on it here. I have a site in which users post stories, and their friends are notified. In order to decouple different parts of the business logic, I would like to use a publish/subscribe mechanism that raises an event

Re: [sqlalchemy] Acting on creation of model instances

2010-05-26 Thread Michael Bayer
On May 26, 2010, at 12:18 AM, Dan Ellis wrote: class EventExtension(SessionExtension): def __init__(self): self.new = [] def after_flush(self, session, flush_context): self.new = session.new return EXT_CONTINUE def after_commit(self, session):