I've got a pretty sophisticated server going...
it's using unit tests that will PUT some data, then do a GET to verify, 
then rollback the transaction to restore the database to its original state.
Doing one session per request kills that, since the new session doesn't 
have the dynamic state of the first one.

The ZopeTransactionManager really should be solving this if I understand 
correctly....



On Friday, August 9, 2013 1:37:48 PM UTC-4, Jonathan Vanasco wrote:
>
> I had been trying to recover by doing a DBSession.close at the end of each 
>> request using 
>>
>>     config.add_subscriber(clearSession, NewRequest)
>>    and where clearSession does DBSesison.close().
>>
>
> i believe you want to use add_finished_callback ( 
> http://docs.pylonsproject.org/projects/pyramid/en/latest/api/request.html#pyramid.request.Request.add_finished_callback)
>
> it might also be better if you did something like :
>
>     my_session = models.DBSession()
>     my_session.query()
>     my_session.add()
>     my_session.commit()
>     my_session.remove()
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/pylons-discuss.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to