Setting global

This commit is contained in:
Ruud
2011-02-23 14:47:21 +01:00
parent cdde98653e
commit 261f6be7e1
5 changed files with 31 additions and 11 deletions
+2 -2
View File
@@ -3,7 +3,7 @@ from flask import request, Response
from functools import wraps
def check_auth(username, password):
return username == Env.get('settings').get('username') and password == Env.get('settings').get('password')
return username == Env.setting('username') and password == Env.setting('password')
def authenticate():
return Response(
@@ -16,7 +16,7 @@ def requires_auth(f):
@wraps(f)
def decorated(*args, **kwargs):
auth = request.authorization
if Env.get('settings').get('username') and (not auth or not check_auth(auth.username, auth.password)):
if Env.setting('username') and (not auth or not check_auth(auth.username, auth.password)):
return authenticate()
return f(*args, **kwargs)