Thank you all for your answers! 

I'll go with the tween solution.

Best
Stefan

On Thursday, June 22, 2017 at 5:58:59 PM UTC+2, [email protected] wrote:
>
> Dear list
>
> I am working on a project using pyramid 1.6, pyramid_tm 1.1.1 and 
> SQLAlchemy 1.1.4. 
>
> A thread-local scoped_session object is used as suggested here 
> <http://docs.pylonsproject.org/projects/pyramid/en/latest/quick_tutorial/databases.html>
>  (knowing 
> that this is probably not the best practice anymore)
>
> DBSession = scoped_session(sessionmaker(extension=ZopeTransactionExtension()))
>
>
> Strangely, I found out that the scoped_session returned by DBSession() is 
> the identical object among several requests—when the request is handled by 
> the same thread.
>
> Apparently, the DBSession.remove() is not called by the transaction 
> manager as (I understand) it should be 
> <http://docs.sqlalchemy.org/en/latest/orm/contextual.html#using-thread-local-scope-with-web-applications>
> .
>
> The problem can be resolved by event listeners either on the side of 
> pyramid or SQLAlchemy but I think this should be directly handled by the 
> transaction manager.
>
> Is this a faulty behavior, or did I get this wrong?
>
> Best
> Stefan
>

-- 
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].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/pylons-discuss/2f080fc7-a2be-4f2d-a45a-de182e1c75cd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to