[WebUI] Fix errors from rearranging code in 2294670

This commit is contained in:
Calum Lind 2014-02-18 20:46:53 +00:00
parent 22946700dd
commit 8d74c3f22a
1 changed files with 12 additions and 9 deletions

View File

@ -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