[Checkins] SVN: Sandbox/philikon/five.publication/trunk/five/publication/ Implemented a generic error view and one for Redirect exceptions (which

Philipp von Weitershausen philikon at philikon.de
Sat Aug 25 21:14:02 EDT 2007


Log message for revision 79275:
  Implemented a generic error view and one for Redirect exceptions (which
  simply redirects).
  

Changed:
  U   Sandbox/philikon/five.publication/trunk/five/publication/configure.zcml
  A   Sandbox/philikon/five.publication/trunk/five/publication/exception.py

-=-
Modified: Sandbox/philikon/five.publication/trunk/five/publication/configure.zcml
===================================================================
--- Sandbox/philikon/five.publication/trunk/five/publication/configure.zcml	2007-08-26 01:12:34 UTC (rev 79274)
+++ Sandbox/philikon/five.publication/trunk/five/publication/configure.zcml	2007-08-26 01:14:02 UTC (rev 79275)
@@ -1,4 +1,6 @@
-<configure xmlns="http://namespaces.zope.org/zope">
+<configure
+    xmlns="http://namespaces.zope.org/zope"
+    xmlns:browser="http://namespaces.zope.org/browser">
 
   <include package="zope.app.publication" file="meta.zcml" />
 
@@ -12,4 +14,23 @@
 
   <adapter factory=".publication.DefaultBrowserPublisher" />
 
+  <browser:defaultView
+      for="zope.interface.common.interfaces.IException"
+      name="index.html"
+      />
+
+  <browser:page
+      for="zope.interface.common.interfaces.IException"
+      name="index.html"
+      class=".exception.SystemError"
+      permission="zope.Public"
+      />
+
+  <browser:page
+      for="zExceptions.Redirect"
+      name="index.html"
+      class=".exception.Redirect"
+      permission="zope.Public"
+      />
+
 </configure>

Added: Sandbox/philikon/five.publication/trunk/five/publication/exception.py
===================================================================
--- Sandbox/philikon/five.publication/trunk/five/publication/exception.py	                        (rev 0)
+++ Sandbox/philikon/five.publication/trunk/five/publication/exception.py	2007-08-26 01:14:02 UTC (rev 79275)
@@ -0,0 +1,13 @@
+from zope.publisher.browser import BrowserPage
+
+class SystemError(BrowserPage):
+
+    def __call__(self):
+        self.request.response.setStatus(500)
+        self.request.response.setHeader('Content-Type', 'text/plain')
+        return 'A system error occurred.'
+
+class Redirect(BrowserPage):
+
+    def __call__(self):
+        self.request.response.redirect(self.context.args[0])


Property changes on: Sandbox/philikon/five.publication/trunk/five/publication/exception.py
___________________________________________________________________
Name: svn:eol-style
   + native



More information about the Checkins mailing list