From ad3012416c44b3305440c83dc45a5e596b896ccf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dan=20Michael=20O=2E=20Hegg=C3=B8?= <danmichaelo@gmail.com> Date: Sun, 9 Dec 2018 15:07:26 +0100 Subject: [PATCH] Change AssertUserFailedError - Make `AssertUserFailedError` inherit `MwClientError` rather than `LoginError`, since it doesn't have the same args. - Move message into args[0], which is more standard Python. --- mwclient/errors.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/mwclient/errors.py b/mwclient/errors.py index a44a5ef..d6aaf49 100644 --- a/mwclient/errors.py +++ b/mwclient/errors.py @@ -65,18 +65,17 @@ class OAuthAuthorizationError(LoginError): return self.info -class AssertUserFailedError(LoginError): +class AssertUserFailedError(MwClientError): def __init__(self): - self.message = 'By default, mwclient protects you from ' + \ - 'accidentally editing without being logged in. If you ' + \ - 'actually want to edit without logging in, you can set ' + \ - 'force_login on the Site object to False.' - - LoginError.__init__(self) + super(AssertUserFailedError, self).__init__( + 'By default, mwclient protects you from accidentally editing ' + + 'without being logged in. If you actually want to edit without ' + + 'logging in, you can set force_login on the Site object to False.' + ) def __str__(self): - return self.message + return self.args[0] class EmailError(MwClientError): -- GitLab