Python – Get original function arguments in decorator

The decorator login_required is passed the function (hello in this case).

So what you want to do is:

def login_required(f):
    # This function is what we "replace" hello with
    def wrapper(*args, **kw):
        args[0].client_session['test'] = True
        logged_in = 0
        if logged_in:
            return f(*args, **kw)  # Call hello
        else:
            return redirect(url_for('login'))
    return wrapper

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)