Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support for generic HTTPException handlers on app and blueprints #2304

Closed
wants to merge 0 commits into from

Conversation

cerickson
Copy link
Contributor

Resolves issue #941, replaces pr #2082 and #2144, code based on #2144, tangentially related to #1383
Error handlers are now returned in order of blueprint:code, app:code, blueprint:HTTPException, app:HTTPException, None

Corresponding tests also added.

@cerickson
Copy link
Contributor Author

This might also close #2197

@jeffwidman
Copy link
Contributor

jeffwidman commented May 23, 2017

@cerickson I don't know how you feel about this, and it might be beyond your git foo, but what do you think about cherry-picking the initial commit from #2144 as the initial commit in your branch and then making your changes on top of that?

The final code would be the same, but that way @sumpfgottheit would get credit for the hard work he did in not only fixing this initially, but also taking the time to write the initial set of tests.

If you're open to this but lacking the git foo, I think Github will let me do it as long as you leave the "maintainers can add commits to this pull request" box checked...

flask/app.py Outdated
"""Finds a registered error handler for the request’s blueprint.
Otherwise falls back to the app, returns None if not a suitable
handler is found.
"""Finds a registered error handlers for a request in this order:

This comment was marked as off-topic.

flask/app.py Outdated
return handler
# check for any in blueprint or app
for name, c in ((request.blueprint, code), (None, code),
(request.blueprint, None), (None,None)):

This comment was marked as off-topic.

@cerickson
Copy link
Contributor Author

I'm not sure how to do that in git, but you are more then welcome to merge the PRs somehow or if you can give me a link or a rough outline of the procedure I'd be happy to try it. We should absolutely give the original PR credit.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants