[wwwsearch-commits] r21979 - wwwsearch/mechanize/trunk/mechanize
jjlee at codespeak.net
jjlee at codespeak.net
Wed Jan 11 21:35:19 CET 2006
Author: jjlee
Date: Wed Jan 11 21:35:18 2006
New Revision: 21979
Modified:
wwwsearch/mechanize/trunk/mechanize/_mechanize.py
Log:
Don't attempt to treat OSError, IOError or socket.error as response objects (this relates to an old urllib2 bug -- these exceptions should never really have been raised by urllib2.OpenerDirector.open in the first place)
Modified: wwwsearch/mechanize/trunk/mechanize/_mechanize.py
==============================================================================
--- wwwsearch/mechanize/trunk/mechanize/_mechanize.py (original)
+++ wwwsearch/mechanize/trunk/mechanize/_mechanize.py Wed Jan 11 21:35:18 2006
@@ -580,10 +580,16 @@
success = True
try:
self._response = UserAgent.open(self, self.request, data)
- except (IOError, socket.error, OSError), error:
- # yes, urllib2 really does raise all these :-((
+ except urllib2.URLError, error:
success = False
self._response = error
+ except (IOError, socket.error, OSError), error:
+ # Yes, urllib2 really does raise all these :-((
+ # I don't want to start fixing these here, though, since this is a
+ # subclass of OpenerDirector, and it would break old code. Even in
+ # Python core, a fix would need some backwards-compat. hack to be
+ # acceptable.
+ raise
if not hasattr(self._response, "seek"):
self._response = response_seek_wrapper(self._response)
self._parse_html(self._response)
More information about the wwwsearch-commits
mailing list