By the way, you can't use db_session.commit() by default (Zope will
shout at you because it thinks it's smarter and that you must under
all circumstances go through transaction.commit()).
The solution is to change the session initialization code a bit (in
<yourproject>/model/__init__.py if you used the quickstart), like the
following:
from zope.sqlalchemy import ZopeTransactionExtension
from sqlalchemy.orm import scoped_session, sessionmaker
class _TransactionExtension(ZopeTransactionExtension):
def before_commit(self, session):
pass
# Global session manager. db_session() returns the session object
# appropriate for the current web request.
maker = sessionmaker(autoflush=True, autocommit=False, twophase=False,
extension=_TransactionExtension())
db_session = scoped_session(maker)
Note to developers: it would be nice if it were done by default in
quickstarted projects.
--
You received this message because you are subscribed to the Google Groups
"TurboGears" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/turbogears?hl=en.