I get that sometimes but I'm not using Repoze.who. For some reason
SQLAlchemy leaves the transaction in a stuck state when an error
occurs until you explicitly do session.rollback().
Except that by the time I get the error email the transaction is
already over so there's nothing I can do about it anyway.
--
Mike Orr <slugg...@gmail.com>
It sounds like a bug in FriendlyForm. If it's using the scoped
session, it should remove it in just before returning. I don't think
it matters if Session.remove() is called twice, once by the
application and once by the middleare. The only problem would be if a
farther-out middleware wants to do some postprocessing on some objects
it fetched during preprocessing. But that's rare, and having
Session.remove() in the application would have prevented it from
working anyway.
The other alternative is to use a separate scoped session and separate
engine for the middleware, so that it's not sharing connections with
the application.
This all does show the limitations of combining global state (a shared
scoped session) with middleware (which doesn't know whether other
middleware has removed the session).
--
Mike Orr <slugg...@gmail.com>
I notice you begin building the query with one dbsession which must be a ScopedSession, then call dbsession.remove(), and then execute the query.
It would probably be better to put dbsession.remove() at the top of the function.
--
You received this message because you are subscribed to the Google Groups "pylons-discuss" group.
To post to this group, send email to pylons-...@googlegroups.com.
To unsubscribe from this group, send email to pylons-discus...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
-- Gustavo Narea <xri://=Gustavo>. | Tech blog: =Gustavo/(+blog)/tech ~ About me: =Gustavo/about |