custom route decorator

This question already has an answer here:

  • Combine two python decorators into one 2 answers
  • How to group decorators in Python 1 answer
  • How to make a chain of function decorators? 15 answers

  • def adminRoute(*route_args, **route_kwargs):
    
        def outer(action_function):
            @app.route(*route_args, **route_kwargs)
            @requiresAdmin
            @functools.wraps(action_function)
            def inner(*f_args, **f_kwargs):
                return action_function(f_args, f_kwargs)
            return inner
    
        return outer
    
    链接地址: http://www.djcxy.com/p/23818.html

    上一篇: 将相同的方法传递给多个装饰器函数

    下一篇: 自定义路由装饰器