def inner(*a, **kw): username = request.params.get('username') or kw.get('username') password = request.params.get('password') if username is None or password is None: raise AuthenticationError user = User(username) if not user.password_auth(password): raise AuthenticationError return func(user=user, *a, **kw)
def inner(*a, **kw): id_ = request.params.get('id') or kw.get('id_') password = request.params.get('password') if id_ is None or password is None: raise AuthenticationError user = User(id_) if not user.password_auth(password): raise AuthenticationError return func(user=user, *a, **kw)