From 2835ad667e2af0b7e0d4f1531b6a2245574f7880 Mon Sep 17 00:00:00 2001 From: Bernardo Damele Date: Thu, 10 Jun 2010 21:11:14 +0000 Subject: [PATCH] Minor exception adjustment --- extra/keepalive/keepalive.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/extra/keepalive/keepalive.py b/extra/keepalive/keepalive.py index 8004f1e1f..402a4335e 100644 --- a/extra/keepalive/keepalive.py +++ b/extra/keepalive/keepalive.py @@ -120,8 +120,7 @@ class HTTPHandler(urllib2.HTTPHandler): data = req.get_data() h.putrequest('POST', req.get_selector()) if not req.headers.has_key('Content-type'): - h.putheader('Content-type', - 'application/x-www-form-urlencoded') + h.putheader('Content-type', 'application/x-www-form-urlencoded') if not req.headers.has_key('Content-length'): h.putheader('Content-length', '%d' % len(data)) else: @@ -134,9 +133,9 @@ class HTTPHandler(urllib2.HTTPHandler): h.endheaders() if req.has_data(): h.send(data) - except: + except socket.error, err: h.close() - raise + raise urllib2.URLError(err) def do_open(self, http_class, req): host = req.get_host()