1066929: authenticated_plus decorator

Added 5 years ago by Peter Bengtsson

Love

1 Add your love!

Tags

Discussion

The default authenticated decorator that comes with tornado is great but in my app I have to make a difference between logged in users and logged in users. Example use:

class SomeHandler(RequestHandler):

    @authenticated_plus(lambda user: user.is_active())
    def get(self):
        ...

I hate how this code repeats the code of tornado.web.authenticated because it means I'd have to maintain my code when the tornado one changes. Ideas for a patch to tornado to make this more modular is welcome!

File: gistfile1.py