Replies: 1 comment 2 replies
-
|
You could simplify this down: # Compatibility with flask < 2.0
if callable(getattr(current_app, "ensure_sync", None)):
return current_app.ensure_sync(fn)(*args, **kwargs)
return fn(*args, **kwargs)Since None isn't callable it'll fail anyways. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
Right now you are using try/catch as a flask 1.x fallback: https://github.com/maxcountryman/flask-login/blob/main/src/flask_login/utils.py#L276
This is problematic, because it messes with log messages. I.e. if my application throws an exception, I would not see [my exception], but "Attribute Error [...] During handling of the exception another exception was raised: [my exception]", which clutters the log with useless information and makes the actually relevant infos harder to spot.
I saw a better way in the flask-jwt-edtended docs: https://flask-jwt-extended.readthedocs.io/en/stable/_modules/flask_jwt_extended/view_decorators/
Would be cool if you could use this method.
Cheers :)
Beta Was this translation helpful? Give feedback.
All reactions