diff --git a/src/utils/web.py b/src/utils/web.py index 1fcae3d96..6a1fa9361 100644 --- a/src/utils/web.py +++ b/src/utils/web.py @@ -37,6 +37,12 @@ import sgmllib import urlparse import htmlentitydefs +sockerrors = (socket.error,) +try: + sockerrors += (socket.sslerror,) +except AttributeError: + pass + from str import normalizeWhitespace Request = urllib2.Request @@ -112,7 +118,7 @@ def getUrlFd(url, headers=None, data=None): return fd except socket.timeout, e: raise Error, TIMED_OUT - except (socket.error, socket.sslerror), e: + except sockerrors, e: raise Error, strError(e) except httplib.InvalidURL, e: raise Error, 'Invalid URL: %s' % e