Multiple decorators

here’s an example on the forum:

Notice the use of the @wraps decorator to ensure that the wrapped function keeps it’s name when it is wrapped.
This saves you having to declare the name explicitly

def custom_wrapper(fn):
    @wraps(fn)
    def wrapper(*args, **kws):
        ... #custom logic
        return fn(*args, **kws)

    return wrapper

And worth remembering the require_user argument which is often sufficient for authentication

3 Likes