I recently ran into an issue with decorators. I have the following code (modified for simplification):
class RecipesView(FlaskView):
decorators = [login_required]
def before_request(self, name, id=None, **kwargs):
print(current_user.full_name)
def index(self):
# do something
login_required using Flask-Security-Too/Flask-Login
And getting an error when an unlogged user goes to /recipes. They shouldn't get there, and they won't, but before_request runs nevertheless, raising error and not getting redirect to /login.
So, is class definition of decorators not applied to before__method_ ? I didn't find that in docs, and it doesn't make much sense in my opinion. Or am I doing something wrong?
Thanks for help and clarification :)
I recently ran into an issue with decorators. I have the following code (modified for simplification):
login_requiredusing Flask-Security-Too/Flask-LoginAnd getting an error when an unlogged user goes to
/recipes. They shouldn't get there, and they won't, butbefore_requestruns nevertheless, raising error and not getting redirect to/login.So, is class definition of decorators not applied to
before__method_? I didn't find that in docs, and it doesn't make much sense in my opinion. Or am I doing something wrong?Thanks for help and clarification :)