diff options
author | Aleksander Machniak <machniak@kolabsys.com> | 2016-05-04 15:55:41 +0200 |
---|---|---|
committer | Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com> | 2016-05-04 15:55:41 +0200 |
commit | f63162347c6f33e1e3db9c49fa154de821dd828d (patch) | |
tree | e6b3809acf80d40cb55bda0c619af1881d923e02 /cyruslib.py | |
parent | c204eaaa2c9a006432fe00489a352833143db01d (diff) | |
download | pykolab-f63162347c6f33e1e3db9c49fa154de821dd828d.tar.gz |
Make sure imaplib exception argument is a string before using split() (#5387)
Summary:
Looks like imaplib in some conditions can throw exceptions without the message or
the message is not a string. We'll cast to string before using split() to prevent from
"AttributeError: 'int' object has no attribute 'split'" errors.
Reviewers: #pykolab_developers, vanmeeuwen
Reviewed By: #pykolab_developers, vanmeeuwen
Differential Revision: https://git.kolab.org/D135
Diffstat (limited to 'cyruslib.py')
-rw-r--r-- | cyruslib.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/cyruslib.py b/cyruslib.py index b8d5dac..3802c00 100644 --- a/cyruslib.py +++ b/cyruslib.py @@ -382,7 +382,7 @@ class CYRUS: if ok(res): return res, msg except Exception, info: - error = info.args[0].split(':').pop().strip() + error = str(info).split(':').pop().strip() if error.upper().startswith('BAD'): error = error.split('BAD', 1).pop().strip() error = unquote(error[1:-1], '\'') @@ -411,7 +411,7 @@ class CYRUS: res, msg = self.m.login(username, password) admin = self.m.isadmin() except Exception, info: - error = info.args[0].split(':').pop().strip() + error = str(info).split(':').pop().strip() self.__doexception("LOGIN", error) if admin: @@ -443,7 +443,7 @@ class CYRUS: try: res, msg = self.m.logout() except Exception, info: - error = info.args[0].split(':').pop().strip() + error = str(info).split(':').pop().strip() self.__doexception("LOGOUT", error) self.AUTH = False self.ADMIN = None |