From 9c51d01b123fed12907e7f3a5f85d19525de3196 Mon Sep 17 00:00:00 2001 From: Bret Taylor Date: Sat, 12 Sep 2009 09:25:03 -0700 Subject: [PATCH] Don't reference Exception.message due to deprecation in Python 2.6 --- tornado/httpclient.py | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/tornado/httpclient.py b/tornado/httpclient.py index 92a5d165..cd37b106 100644 --- a/tornado/httpclient.py +++ b/tornado/httpclient.py @@ -310,14 +310,8 @@ class HTTPResponse(object): class HTTPError(Exception): def __init__(self, code, message=None): self.code = code - Exception.__init__(self, "HTTP %d" % self.code) - - def __repr__(self): - return "%s(%r)" % (self.__class__.__name__, self.code) - - def __str__(self): - return "%d: %s" % (self.code, httplib.responses.get( - self.code, "Unknown")) + message = message or httplib.responses.get(code, "Unknown") + Exception.__init__(self, "HTTP %d: %s" % (self.code, message)) class CurlError(HTTPError): @@ -325,13 +319,6 @@ class CurlError(HTTPError): HTTPError.__init__(self, 599, message) self.errno = errno - def __repr__(self): - return "%s(%r,%r)" % (self.__class__.__name__, self.errno, - self.message) - - def __str__(self): - return "%d: %s" % (self.errno, self.message) - def _curl_create(max_simultaneous_connections=None): curl = pycurl.Curl()