Michael Bayer schrieb:
> the close() will remove any objects left in the session and may help with
> unit tests in that the subsequent tests aren't interfered with by objects
> remaining from the previous test. 

Where is the difference between a process running several tests and one 
answering several http requests via mod_wsgi?

The code to set up the session is this:

DBSession = scoped_session(sessionmaker(
     autoflush=True,
     autocommit=False,
     ))

Then code running DB-stuff is wrapped into begin/(commit/rollback) via a 
decorator. This is the same for my tests as well as the production system.

So if the close() is needed for tests, I presume it's needed for the 
production code as well?

> but its better to use a distinct
> Session for each test and keep things simple.   I keep hearing about
> Turbogears not allowing complete control over sessions and I'm getting
> annoyed by this "feature".


Actually I removed the TG-session-facilities because of other problems, 
and then the troubles with the not-closed session began.

But you have a point, the current way of dealing with SA-transactions in 
TG2 isn't satisfactory.

Diez

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to