[Checkins] SVN: zope.app.zptpage/trunk/ - Moved a test here from ``zope.app.exception``.

Michael Howitz mh at gocept.com
Tue Sep 14 09:00:18 EDT 2010


Log message for revision 116381:
  - Moved a test here from ``zope.app.exception``.
  

Changed:
  U   zope.app.zptpage/trunk/CHANGES.txt
  A   zope.app.zptpage/trunk/src/zope/app/zptpage/browser/errorview.txt
  U   zope.app.zptpage/trunk/src/zope/app/zptpage/browser/tests.py
  U   zope.app.zptpage/trunk/src/zope/app/zptpage/ftesting.zcml

-=-
Modified: zope.app.zptpage/trunk/CHANGES.txt
===================================================================
--- zope.app.zptpage/trunk/CHANGES.txt	2010-09-14 12:47:31 UTC (rev 116380)
+++ zope.app.zptpage/trunk/CHANGES.txt	2010-09-14 13:00:17 UTC (rev 116381)
@@ -5,7 +5,7 @@
 3.5.2 (unreleased)
 ------------------
 
-- Nothing changed yet.
+- Moved a test here from ``zope.app.exception``.
 
 
 3.5.1 (2010-01-08)

Added: zope.app.zptpage/trunk/src/zope/app/zptpage/browser/errorview.txt
===================================================================
--- zope.app.zptpage/trunk/src/zope/app/zptpage/browser/errorview.txt	                        (rev 0)
+++ zope.app.zptpage/trunk/src/zope/app/zptpage/browser/errorview.txt	2010-09-14 13:00:17 UTC (rev 116381)
@@ -0,0 +1,60 @@
+System Errors
+=============
+
+System Errors are errors representing a system failure.  At the
+application level, they are errors that are uncaught by the
+application and that a developer hasn't provided a custom error view
+for.
+
+Zope provides a default system error view that prints an obnoxius
+terse message and that sets the response status.
+
+To see an example of this, we'll create a ZPT page with an intentional
+error:
+
+  >>> print http(r"""
+  ... POST /+/zope.app.zptpage.ZPTPage%3D HTTP/1.1
+  ... Authorization: Basic mgr:mgrpw
+  ... Content-Length: 739
+  ... Content-Type: multipart/form-data; boundary=---------------------------125598457818223697821067764270
+  ... Referer: http://localhost:8081/+/zope.app.zptpage.ZPTPage=
+  ...
+  ... -----------------------------125598457818223697821067764270
+  ... Content-Disposition: form-data; name="field.source"
+  ...
+  ... <html><body tal:content="container/eek" /></html>
+  ... -----------------------------125598457818223697821067764270
+  ... Content-Disposition: form-data; name="field.expand.used"
+  ...
+  ...
+  ... -----------------------------125598457818223697821067764270
+  ... Content-Disposition: form-data; name="field.evaluateInlineCode.used"
+  ...
+  ...
+  ... -----------------------------125598457818223697821067764270
+  ... Content-Disposition: form-data; name="UPDATE_SUBMIT"
+  ...
+  ... Add
+  ... -----------------------------125598457818223697821067764270
+  ... Content-Disposition: form-data; name="add_input_name"
+  ...
+  ... test.html
+  ... -----------------------------125598457818223697821067764270--
+  ... """)
+  HTTP/1.1 303 See Other
+  ...
+  Location: http://localhost/@@contents.html
+  ...
+
+When we visit it, we get a terse error and a 500 status:
+
+We get a system error, because the problem is in the template, not in
+the URL:
+
+  >>> print http(r"""
+  ... GET /test.html HTTP/1.1
+  ... """)
+  HTTP/1.1 500 Internal Server Error
+  ...
+    A system error occurred.
+  ...


Property changes on: zope.app.zptpage/trunk/src/zope/app/zptpage/browser/errorview.txt
___________________________________________________________________
Added: svn:keywords
   + Id Rev Date
Added: svn:eol-style
   + native

Modified: zope.app.zptpage/trunk/src/zope/app/zptpage/browser/tests.py
===================================================================
--- zope.app.zptpage/trunk/src/zope/app/zptpage/browser/tests.py	2010-09-14 12:47:31 UTC (rev 116380)
+++ zope.app.zptpage/trunk/src/zope/app/zptpage/browser/tests.py	2010-09-14 13:00:17 UTC (rev 116381)
@@ -208,7 +208,10 @@
 def test_suite():
     from zope.app.testing.functional import FunctionalDocFileSuite
     collector = FunctionalDocFileSuite(
-        'collector266.txt', 'collector269.txt', checker=checker)
+        'collector266.txt',
+        'collector269.txt',
+        'errorview.txt',
+        checker=checker)
     url = FunctionalDocFileSuite('url.txt', checker=checker)
     collector.layer = ZPTPageLayer
     ZPTPageTest.layer = ZPTPageLayer

Modified: zope.app.zptpage/trunk/src/zope/app/zptpage/ftesting.zcml
===================================================================
--- zope.app.zptpage/trunk/src/zope/app/zptpage/ftesting.zcml	2010-09-14 12:47:31 UTC (rev 116380)
+++ zope.app.zptpage/trunk/src/zope/app/zptpage/ftesting.zcml	2010-09-14 13:00:17 UTC (rev 116381)
@@ -23,8 +23,15 @@
   <role id="zope.Manager" title="Site Manager" />
 
   <grantAll role="zope.Manager" />
-  <include package="zope.app.securitypolicy.browser.tests" file="functional.zcml" />
+  <include package="zope.app.securitypolicy.browser.tests"
+           file="functional.zcml" />
 
+  <role id="zope.Anonymous"
+        title="Everybody"
+        description="All users have this role implicitly" />
+  <grant permission="zope.View"
+         role="zope.Anonymous" />
+
   <!-- Principal that tests generally run as -->
   <principal
       id="zope.mgr"



More information about the checkins mailing list