diff options
author | Johan Lundberg <lundberg@nordu.net> | 2014-04-06 02:44:44 +0200 |
---|---|---|
committer | Johan Lundberg <lundberg@nordu.net> | 2014-04-06 02:44:44 +0200 |
commit | 55d91f8d7d42c7607474a045dc7189ab4ec7e12f (patch) | |
tree | 0fea7f1e455bc1dced4e9709926249a810710136 | |
parent | 91395c1cbcc9b459206a9a651fd619feb5ef756b (diff) |
Handling TypeError in ACPException.
-rw-r--r-- | meetingtools/ac/api.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/meetingtools/ac/api.py b/meetingtools/ac/api.py index cd3ac7b..1a8cb87 100644 --- a/meetingtools/ac/api.py +++ b/meetingtools/ac/api.py @@ -28,7 +28,10 @@ class ACPException(Exception): Exception.__init__(self, value) def __str__(self): - return etree.tostring(self.value) + try: + return etree.tostring(self.value) + except TypeError: + return str(self.value) def _first_or_none(x): @@ -160,7 +163,7 @@ class ACPClient(): logging.debug(pformat(resp)) logging.debug(pformat(content)) if resp.status != 200: - raise ACPException, resp.reason + raise ACPException(resp.reason) if resp.has_key('set-cookie'): cookie = resp['set-cookie'] |