diff --git a/deluge/ui/web/auth.py b/deluge/ui/web/auth.py index 870bd70e3..5019fa3ba 100644 --- a/deluge/ui/web/auth.py +++ b/deluge/ui/web/auth.py @@ -42,11 +42,11 @@ from email.utils import formatdate from twisted.internet.task import LoopingCall from deluge import component -from deluge.ui.web.json_api import JSONComponent, export from deluge.common import utf8_encoded log = logging.getLogger(__name__) + AUTH_LEVEL_NONE = 0 AUTH_LEVEL_READONLY = 1 AUTH_LEVEL_NORMAL = 5 @@ -55,6 +55,17 @@ AUTH_LEVEL_ADMIN = 10 AUTH_LEVEL_DEFAULT = AUTH_LEVEL_NORMAL +class AuthError(Exception): + """ + An exception that might be raised when checking a request for + authentication. + """ + pass + +# Import after as json_api imports the above AuthError and AUTH_LEVEL_DEFAULT +from deluge.ui.web.json_api import JSONComponent, export + + def make_checksum(session_id): return reduce(lambda x, y: x+y, map(ord, session_id)) @@ -318,11 +329,3 @@ class Auth(JSONComponent): else: log.error('Login failed (ClientIP %s)', __request__.getClientIP()) return False - - -class AuthError(Exception): - """ - An exception that might be raised when checking a request for - authentication. - """ - pass