In contrast to the way it's normally done, stucco_auth implements a non-threadlocal SQLAlchemy strategy.
In the pyramid_alchemy paster template, the SQLAlchemy session is a module-level object with a threadlocal behind the scenes and the declarative base is bound to a particular engine: DBSession = sqlalchemy.orm.scoped_session(sqlalchemy.orm.sessionmaker()) Base = declarative_base() def initialize_sql(engine): Base.metadata.bind = engine stucco_auth's demo application doesn't do that. The session factory is not a module-global scoped session and cannot be imported by other code. Instead, it is a local variable in the WSGI app's creation function, normally only touched by the transaction manager to create the per-request session. Base.metadata.bind is never set. Although the session factory is stored in the settings as a back door for scripting, normal view code only ever interacts with the SQLAlchemy session as a property of the request 'request.db'. I am very happy to report that this strategy works great. Far from missing the module-level global threadlocal scoped session, I'm happier without it as it makes the code easier to understand and test, and there is no need to agree on a common module to hold those globals. Daniel Holth -- You received this message because you are subscribed to the Google Groups "pylons-devel" group. To post to this group, send email to pylons-devel@googlegroups.com. To unsubscribe from this group, send email to pylons-devel+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/pylons-devel?hl=en.