Re: pyramid_tm: problem upgrading to 0.3

2011-09-28 Thread Michael Merickel
pyramid_tm is now a tween placed under excview. Thus the pipeline for a
request ends up:

wsgi server <-> exception views <-> pyramid_tm <-> pyramid

So the issue here is that pyramid_tm actually expires the commit *before*
the exception view is executed. This means that you cannot do database
operations in an exception view as it stands without managing the connection
yourself.

The rationale is behind this is that it makes the api for using the tm more
sane. In the past pyramid_tm has used a commit veto that aborts when there
is 4xx/5xx responses, exceptions, or x-tm=abort headers. This is fairly
complicated and the current interface is simply to abort on exceptions.

The old behavior is achievable by placing the pyramid_tm tween over excview
instead of under, and using the default_commit_veto that you pasted.

In terms of fixing this to allow database operations within your exception
views, suggestions are welcome, but I think in general the new behavior is
more sane.

-- 

Michael

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



pyramid_tm: problem upgrading to 0.3

2011-09-27 Thread Robert Forkel
Hi all,
I'm having trouble upgrading pyramid_tm to 0.3 for an app running on
pyramid 1.2. As far as I could tell, adding

  settings['tm.commit_veto'] = 'pyramid_tm.default_commit_veto'

before passing the settings to the configurator should be enough to
restore the behaviour pre 0.3. But I'm seeing errors like

DetachedInstanceError: Parent instance  is not
bound to a Session; lazy load operation of attribute 'person_assocs'
cannot proceed

for unauthorized requests (i.e. ones returning 403); which looks like
a database rollback hasn't happened?
Is 0.3 not intended for use with pyramid 1.2?
regards
robert

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