Calling auth methods

This commit is contained in:
apahomov
2013-01-14 16:11:09 +04:00
parent bbed019ca5
commit 3f9ca423bd
+3 -2
View File
@@ -137,8 +137,9 @@ def auth_required(*auth_methods):
@wraps(fn)
def decorated_view(*args, **kwargs):
mechanisms = [login_mechanisms.get(method) for method in auth_methods]
if any(mechanisms):
return fn(*args, **kwargs)
for mechanism in mechanisms:
if mechanism and mechanism():
return fn(*args, **kwargs)
return _get_unauthorized_response()
return decorated_view
return wrapper