[Checkins]
SVN: zope.testbrowser/trunk/src/zope/testbrowser/README.txt
Added tests for raiseHttpErrors attribute.
Aaron Lehmann
aaron at zope.com
Thu May 31 17:09:58 EDT 2007
Log message for revision 76064:
Added tests for raiseHttpErrors attribute.
Changed:
U zope.testbrowser/trunk/src/zope/testbrowser/README.txt
-=-
Modified: zope.testbrowser/trunk/src/zope/testbrowser/README.txt
===================================================================
--- zope.testbrowser/trunk/src/zope/testbrowser/README.txt 2007-05-31 20:26:27 UTC (rev 76063)
+++ zope.testbrowser/trunk/src/zope/testbrowser/README.txt 2007-05-31 21:09:58 UTC (rev 76064)
@@ -1159,7 +1159,37 @@
publisher or can otherwise respond appropriately to an
'X-zope-handle-errors' header in requests.
+When the testbrowser is raising HttpErrors, the errors still hit the test.
+Sometimes we don't want that to happen, in situations where there are edge
+cases that will cause the error to be predictabley but infrequently raised.
+Time is a primary cause of this.
+To get around this, one can set the raiseHttpErrors to False.
+
+ >>> browser.handleErrors = True
+ >>> browser.raiseHttpErrors = False
+
+This will cause HttpErrors not to propagate.
+
+ >>> browser.open('http://localhost/invalid')
+
+The headers are still there, though.
+
+ >>> '404 Not Found' in str(browser.headers)
+ True
+
+If we don't handle the errors, and allow internal ones to propagate, however,
+this flage doesn't affect things.
+
+ >>> browser.handleErrors = False
+ >>> browser.open('http://localhost/invalid')
+ Traceback (most recent call last):
+ ...
+ NotFound: Object: <zope.app.folder.folder.Folder object at ...>,
+ name: u'invalid'
+
+ >>> browser.raiseHttpErrors = True
+
Hand-Holding
------------
More information about the Checkins
mailing list