-
Notifications
You must be signed in to change notification settings - Fork 190
fix for #58 #59
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
fix for #58 #59
Changes from 1 commit
949890f
fb5e5bb
43796ba
4f3af90
9237425
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,7 @@ | |
from werkzeug.exceptions import HTTPException | ||
import re | ||
import sys | ||
from flask import __version__ as flask_version | ||
|
||
|
||
api_resources = Blueprint( | ||
|
@@ -88,9 +89,15 @@ def handle_user_exception(self, e): | |
if handlers is not None: | ||
blueprint_handlers = handlers.get(None, ()) | ||
app_handlers = self.error_handler_spec[None].get(None, ()) | ||
for typecheck, handler in chain(blueprint_handlers.items(), app_handlers.items()): | ||
if isinstance(e, typecheck): | ||
return handler(e) | ||
flask_version.split() | ||
if self.get_minor_version() <= 10: | ||
for typecheck, handler in chain(blueprint_handlers, app_handlers): | ||
if isinstance(e, typecheck): | ||
return handler(e) | ||
else: | ||
for typecheck, handler in chain(blueprint_handlers.items(), app_handlers.items()): | ||
if isinstance(e, typecheck): | ||
return handler(e) | ||
|
||
reraise(exc_type, exc_value, tb) | ||
|
||
|
@@ -116,3 +123,7 @@ def create_url_adapter(self, request): | |
self.config['SERVER_NAME'], | ||
script_name=self.config['APPLICATION_ROOT'] or '/', | ||
url_scheme=self.config['PREFERRED_URL_SCHEME']) | ||
|
||
@staticmethod | ||
def get_minor_version(): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wonder if this function might make more sense to live in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. sure, can do that. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Or |
||
return int(flask_version.split(".")[1]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this line has any affect.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will amend.