summaryrefslogtreecommitdiffstats
path: root/deluge/ui/web/auth.py
diff options
context:
space:
mode:
authorCalum Lind <calumlind+deluge@gmail.com>2014-02-18 20:46:53 +0000
committerCalum Lind <calumlind+deluge@gmail.com>2014-02-18 20:46:53 +0000
commit8d74c3f22af48388d533daad5ee9622a671eb115 (patch)
tree51111b94187ceee20c1fcf96af70f4d81b6ef5fd /deluge/ui/web/auth.py
parent22946700ddd8c7305c083450dbba589b2f7831be (diff)
downloaddeluge-8d74c3f22af48388d533daad5ee9622a671eb115.tar.gz
deluge-8d74c3f22af48388d533daad5ee9622a671eb115.tar.bz2
deluge-8d74c3f22af48388d533daad5ee9622a671eb115.zip
[WebUI] Fix errors from rearranging code in 2294670
Diffstat (limited to 'deluge/ui/web/auth.py')
-rw-r--r--deluge/ui/web/auth.py21
1 files 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