summaryrefslogtreecommitdiffstats
path: root/deluge/error.py
diff options
context:
space:
mode:
authorPedro Algarvio <ufs@ufsoft.org>2011-04-27 19:28:16 +0100
committerPedro Algarvio <ufs@ufsoft.org>2011-04-27 19:32:13 +0100
commitf41f6ad46a8cfd5ed8294798586d6e0925bc3afd (patch)
tree9d5e7fd49188687d18affddcb06ee2412bedab3e /deluge/error.py
parentbb9a8509c85f6f9f0b4626a194e58ab0c5d9ac0c (diff)
downloaddeluge-f41f6ad46a8cfd5ed8294798586d6e0925bc3afd.tar.gz
deluge-f41f6ad46a8cfd5ed8294798586d6e0925bc3afd.tar.bz2
deluge-f41f6ad46a8cfd5ed8294798586d6e0925bc3afd.zip
Test fixes and #1814 fix.
All test were adapted, and some more were added to comply with the new multiuser support in deluge. Regarding #1814, host entries in the Connection Manager UI are now migrated from the old format were automatic localhost logins were possible, which no longer is.
Diffstat (limited to 'deluge/error.py')
-rw-r--r--deluge/error.py27
1 files changed, 20 insertions, 7 deletions
diff --git a/deluge/error.py b/deluge/error.py
index cdb67091a..95d00fce8 100644
--- a/deluge/error.py
+++ b/deluge/error.py
@@ -50,11 +50,24 @@ class InvalidTorrentError(DelugeError):
class InvalidPathError(DelugeError):
pass
-class NotAuthorizedError(DelugeError):
- pass
+class __PassthroughError(DelugeError):
+ def __new__(cls, *args, **kwargs):
+ inst = super(__PassthroughError, cls).__new__(cls, *args, **kwargs)
+ inst._args = args
+ inst._kwargs = kwargs
+ return inst
+
+class NotAuthorizedError(__PassthroughError):
+ def __init__(self, current_level, required_level):
+ self.message = _(
+ "Auth level too low: %(current_level)s < %(required_level)s" %
+ dict(current_level=current_level, required_level=required_level)
+ )
+ self.current_level = current_level
+ self.required_level = required_level
-class _UsernameBasedException(DelugeError):
+class __UsernameBasedPasstroughError(__PassthroughError):
def _get_message(self):
return self._message
@@ -71,16 +84,16 @@ class _UsernameBasedException(DelugeError):
del _get_username, _set_username
def __init__(self, message, username):
- super(_UsernameBasedException, self).__init__(message)
+ super(__UsernameBasedPasstroughError, self).__init__(message)
self.message = message
self.username = username
-class BadLoginError(_UsernameBasedException):
+class BadLoginError(__UsernameBasedPasstroughError):
pass
-class AuthenticationRequired(BadLoginError):
+class AuthenticationRequired(__UsernameBasedPasstroughError):
pass
-class AuthManagerError(_UsernameBasedException):
+class AuthManagerError(__UsernameBasedPasstroughError):
pass