From 55d91f8d7d42c7607474a045dc7189ab4ec7e12f Mon Sep 17 00:00:00 2001 From: Johan Lundberg Date: Sun, 6 Apr 2014 02:44:44 +0200 Subject: Handling TypeError in ACPException. --- meetingtools/ac/api.py | 7 +++++-- 1 file 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'] -- cgit v1.1