[wwwsearch-commits] r43811 - wwwsearch/mechanize/trunk/mechanize

jjlee at codespeak.net jjlee at codespeak.net
Mon May 28 18:11:08 CEST 2007


Author: jjlee
Date: Mon May 28 18:11:07 2007
New Revision: 43811

Modified:
   wwwsearch/mechanize/trunk/mechanize/_http.py
Log:
Add some debugging code to show URL with HTTPErrors (would be nice to always have this, but don't want to change the precise exception raised right now)

Modified: wwwsearch/mechanize/trunk/mechanize/_http.py
==============================================================================
--- wwwsearch/mechanize/trunk/mechanize/_http.py	(original)
+++ wwwsearch/mechanize/trunk/mechanize/_http.py	Mon May 28 18:11:07 2007
@@ -27,6 +27,12 @@
 
 debug = logging.getLogger("mechanize").debug
 
+# monkeypatch urllib2.HTTPError to show URL
+## def urllib2_str(self):
+##     return 'HTTP Error %s: %s (%s)' % (
+##         self.code, self.msg, self.geturl())
+## urllib2.HTTPError.__str__ = urllib2_str
+
 
 CHUNK = 1024  # size of chunks fed to HTML HEAD parser, in bytes
 DEFAULT_ENCODING = 'latin-1'


More information about the wwwsearch-commits mailing list