Skip to content

decorators not working on before_method? #133

Open
@janpeterka

Description

@janpeterka

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

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions