[Zope3-checkins] SVN: Zope3/trunk/src/zope/testbrowser/browser.py HTTP status codes in the 200s aren't errors and shouldn't generate exceptions

Benji York benji at zope.com
Wed Mar 15 16:43:56 EST 2006


Log message for revision 66048:
  HTTP status codes in the 200s aren't errors and shouldn't generate exceptions
  

Changed:
  U   Zope3/trunk/src/zope/testbrowser/browser.py

-=-
Modified: Zope3/trunk/src/zope/testbrowser/browser.py
===================================================================
--- Zope3/trunk/src/zope/testbrowser/browser.py	2006-03-15 21:35:12 UTC (rev 66047)
+++ Zope3/trunk/src/zope/testbrowser/browser.py	2006-03-15 21:43:56 UTC (rev 66048)
@@ -207,7 +207,15 @@
     def open(self, url, data=None):
         """See zope.testbrowser.interfaces.IBrowser"""
         self._start_timer()
-        self.mech_browser.open(url, data)
+        try:
+            self.mech_browser.open(url, data)
+        except urllib2.HTTPError, e:
+            if e.code >= 200 and e.code <= 299:
+                # 200s aren't really errors
+                pass
+            else:
+                raise
+
         self._stop_timer()
         self._changed()
 



More information about the Zope3-Checkins mailing list