On Nov 18, 5:05 pm, Gustavo Narea <[email protected]> wrote:
> If I make repoze.who.plugins.sa handle the exception, I'd be silencing
> that error, which I'd rather not do as that sort of things always make
> debugging harder.
Sorry if I wasn't clear enough. I was suggesting doing something like
except:
Session.rollback()
raise
rather than handling the exception entirely.
> If you had another WSGI middleware that uses SA, chances are you'd get
> the same error, so I think a better solution for you would be to
> subclass ErrorMiddleware like this:
> """
> class MyErrorMiddleware(ErrorMiddleware):
>
> def exception_handler(self, exc_info, environ):
> exception_class = exc_info[0]
> if exception_class in (InvalidRequestError, OperationalError):
> # rollback...
> return super(MyErrorMiddleware,
> self).exception_handler(exc_info, environ)
> """
>
> That should avoid the second exception, allowing the error page to be
> returned without problems. And it'd also work if that error happens
> within your application and you're not expecting it.
Perfect! Thanks for all of your help.
--
Josh Kelley
--
You received this message because you are subscribed to the Google Groups
"pylons-discuss" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/pylons-discuss?hl=en.