Apply zope transaction to global Tailbone Session class.

This commit is contained in:
Lance Edgar 2014-02-15 19:27:50 -08:00
parent d6f2b1afb1
commit 67f8960655

View file

@ -29,7 +29,14 @@ Database Stuff
from sqlalchemy.orm import sessionmaker, scoped_session
__all__ = ['Session']
Session = scoped_session(sessionmaker())
try:
# Requires zope.sqlalchemy >= 0.7.4
from zope.sqlalchemy import register
except ImportError:
from zope.sqlalchemy import ZopeTransactionExtension
Session.configure(extension=ZopeTransactionExtension())
else:
register(Session)