diff options
author | Calum Lind <calumlind+deluge@gmail.com> | 2017-06-23 12:19:39 +0100 |
---|---|---|
committer | Calum Lind <calumlind+deluge@gmail.com> | 2017-06-23 12:19:39 +0100 |
commit | 0cc0882ac90fb32ea75b2628abe38734015b06fc (patch) | |
tree | 5137728eab1632d45051309bbbe682d8084a9aea /deluge/ui/web/auth.py | |
parent | a7c4228ce79bdd7b8658322173430773c06bbc24 (diff) | |
download | deluge-0cc0882ac90fb32ea75b2628abe38734015b06fc.tar.gz deluge-0cc0882ac90fb32ea75b2628abe38734015b06fc.tar.bz2 deluge-0cc0882ac90fb32ea75b2628abe38734015b06fc.zip |
[WebUI] Refactor out AuthError for NotAuthorizedError
Diffstat (limited to 'deluge/ui/web/auth.py')
-rw-r--r-- | deluge/ui/web/auth.py | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/deluge/ui/web/auth.py b/deluge/ui/web/auth.py index 0a2ad0ac3..5416b677d 100644 --- a/deluge/ui/web/auth.py +++ b/deluge/ui/web/auth.py @@ -19,21 +19,12 @@ from email.utils import formatdate from twisted.internet.task import LoopingCall from deluge.common import AUTH_LEVEL_ADMIN, AUTH_LEVEL_NONE +from deluge.error import NotAuthorizedError +from deluge.ui.web.json_api import JSONComponent, export log = logging.getLogger(__name__) -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 -from deluge.ui.web.json_api import export, JSONComponent # NOQA, isort:skip pylint: disable=wrong-import-position - - def make_checksum(session_id): checksum = 0 for value in [ord(char) for char in session_id]: @@ -226,7 +217,7 @@ class Auth(JSONComponent): request.session_id = session_id if auth_level < level: - raise AuthError('Not authenticated') + raise NotAuthorizedError(auth_level, level) def _change_password(self, new_password): """ |