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

decorators not working on before_method? #133

Open
janpeterka opened this issue Jul 5, 2021 · 0 comments
Open

decorators not working on before_method? #133

janpeterka opened this issue Jul 5, 2021 · 0 comments

Comments

@janpeterka
Copy link
Contributor

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 :)

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

No branches or pull requests

1 participant