[Checkins]
SVN: zope.testbrowser/trunk/src/zope/testbrowser/browser.py
add the ability to suppress raising exceptions on HTTP errors;
Aaron will
Benji York
benji at zope.com
Thu May 31 16:18:22 EDT 2007
Log message for revision 76062:
add the ability to suppress raising exceptions on HTTP errors; Aaron will
follow-up with tests presently
Changed:
U zope.testbrowser/trunk/src/zope/testbrowser/browser.py
-=-
Modified: zope.testbrowser/trunk/src/zope/testbrowser/browser.py
===================================================================
--- zope.testbrowser/trunk/src/zope/testbrowser/browser.py 2007-05-31 19:56:38 UTC (rev 76061)
+++ zope.testbrowser/trunk/src/zope/testbrowser/browser.py 2007-05-31 20:18:22 UTC (rev 76062)
@@ -158,6 +158,7 @@
mech_browser = mechanize.Browser()
self.mech_browser = mech_browser
self.timer = PystoneTimer()
+ self.raiseHttpErrors = True
self._enable_setattr_errors = True
if url is not None:
@@ -225,7 +226,7 @@
if e.code >= 200 and e.code <= 299:
# 200s aren't really errors
pass
- else:
+ elif self.raiseHttpErrors:
raise
finally:
self._stop_timer()
@@ -235,7 +236,7 @@
if 'Status' in self.headers:
code, msg = self.headers['Status'].split(' ', 1)
code = int(code)
- if code >= 400:
+ if self.raiseHttpErrors and code >= 400:
raise urllib2.HTTPError(url, code, msg, self.headers, fp=None)
def _start_timer(self):
More information about the Checkins
mailing list