Skip to content
Myr

Always trap proxy exceptions

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Armin Ronacher · committed by Armin Ronacher · parent ff2e844 · Browse files · 2 files+8 added−2 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+8 added−2 removed

  • other:+8 added−2 removed

2 files+8 added−2 removed

modified:flask/app.py+6 added-2 removed
1325 unmodified lines
13261327 # ensure not to trash sys.exc_info() at that point in case someone1328 # wants the traceback preserved in handle_http_exception. Of course1329 # we cannot prevent users from trashing it themselves in a custom1330 # trap_http_exception method so that's their fault then.1331 if isinstance(e, HTTPException) and not self.trap_http_exception(e):1330 # trap_http_exception method so that's their fault then. Proxy1331 # exceptions generally must always be trapped (filtered out by1332 # e.code == None)1333 if isinstance(e, HTTPException) \1334 and e.code is not None \1335 and not self.trap_http_exception(e):1336 return self.handle_http_exception(e)13371338 blueprint_handlers = ()1339 handlers = self.error_handler_spec.get(request.blueprint)
445 unmodified lines
modified:CHANGES+2 added
41 unmodified lines
42- `request`, `session` and `g` are now also added as proxies to the template43 context which makes them available in imported templates. One has to be44 very careful with those though because usage outside of macros might45 cause caching.46- Flask will no longer invoke the wrong error handlers if a proxy47 exception is passed through.4849Version 0.950-----------51
365 unmodified lines