From 8d74c3f22af48388d533daad5ee9622a671eb115 Mon Sep 17 00:00:00 2001 From: Calum Lind Date: Tue, 18 Feb 2014 20:46:53 +0000 Subject: [PATCH] [WebUI] Fix errors from rearranging code in 2294670 --- deluge/ui/web/auth.py | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) 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