[Flask] combing decorators

Corey Boyle coreybrett at gmail.com
Tue Jun 4 15:38:32 EDT 2019


I need to create a new decorator for my views to handle different users
having different roles/access levels.

Something like this...
@role_required('SALES')


So my views would end up something like this...
@blueprint.route('/post')
@login_required
@role_required(['SALES'])
def post():
    pass

Is there any way for me to combine those decorators?
Maybe something like...
@view('/post', ['SALES'])
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/flask/attachments/20190604/039a100d/attachment.html>


More information about the Flask mailing list