Re: [pylons-devel] Uncatchable InvalidRequestError within view depending on order of SQLAlchemy queries

2016-03-21 Thread Simon King
Your exception block *is* catching an exception, but that's not the exception you are seeing being logged. Imagine the code in pyramid_tm does something like this (where "handler" is the view function, in your case exception_test): # Actual code is at # https://github.com/Pylons/pyramid_tm/blob/ma

Re: [pylons-devel] Uncatchable InvalidRequestError within view depending on order of SQLAlchemy queries

2016-03-21 Thread Zsolt Ero
I'll try to make a minimal reproducible sample of out if. For autoflush, I tried putting manual flush lines between the commands but the results were the same. About exception, it is entering the exception block (I tried putting print 'exception' there) but it is not catching it. Zsolt On 21 Ma

Re: [pylons-devel] Uncatchable InvalidRequestError within view depending on order of SQLAlchemy queries

2016-03-21 Thread Simon King
On Sat, Mar 19, 2016 at 3:44 AM, Zsolt Ero wrote: > My project is based on standard SQLAlchemy scaffold, ZTE, using ORM. > Pyramid 1.5.8. > > I'm trying to catch an IntegrityError (unique key constraint), I've made a > very minimal example > > @view_config(route_name='exception_test', renderer='j

[pylons-devel] Uncatchable InvalidRequestError within view depending on order of SQLAlchemy queries

2016-03-18 Thread Zsolt Ero
My project is based on standard SQLAlchemy scaffold, ZTE, using ORM. Pyramid 1.5.8. I'm trying to catch an IntegrityError (unique key constraint), I've made a very minimal example @view_config(route_name='exception_test', renderer='json') def exception_test(request): user = DBSession.query(