[Zope-dev] zope.sqlalchemy+py3 test failures.
Laurence Rowe
l at lrowe.co.uk
Thu Sep 29 11:25:05 EST 2011
On 29 September 2011 16:51, Chris Withers <chris at simplistix.co.uk> wrote:
> It'd also be great if we could get support for SA 0.7+'s new events
> system...
I'm not convinced this will give any benefit. Currently we just require:
>>> Session = scoped_session(sessionmaker(bind=engine,
... extension=ZopeTransactionExtension()))
Instead we would require something like:
>>> Session = scoped_session(sessionmaker(bind=engine))
>>> ext = ZopeTransactionExtension()
>>> event.listen(Session, "after_attach", ext.after_attach)
>>> event.listen(Session, "after_begin", ext.after_begin)
>>> event.listen(Session, "after_flush", ext.after_flush)
>>> event.listen(Session, "after_bulk_update", ext.after_bulk_update)
>>> event.listen(Session, "after_bulk_delete", ext.after_bulk_delete)
>>> event.listen(Session, "before_commit", ext.before_commit)
Though this could become:
>>> Session = scoped_session(sessionmaker(bind=engine))
>>> ZopeTransactionExtension(Session)
I'm just not sure that it's worthwhile.
Laurence
More information about the Zope-Dev
mailing list