[Checkins] SVN: Sandbox/philikon/five.publication/trunk/five/publication/ Two more exception views

Philipp von Weitershausen philikon at philikon.de
Sun Aug 26 06:44:27 EDT 2007


Log message for revision 79283:
  Two more exception views
  

Changed:
  U   Sandbox/philikon/five.publication/trunk/five/publication/configure.zcml
  U   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 10:37:48 UTC (rev 79282)
+++ Sandbox/philikon/five.publication/trunk/five/publication/configure.zcml	2007-08-26 10:44:26 UTC (rev 79283)
@@ -33,4 +33,25 @@
       permission="zope.Public"
       />
 
+  <browser:page
+      for="zExceptions.NotFound"
+      name="index.html"
+      class=".exception.NotFound"
+      permission="zope.Public"
+      />
+
+  <browser:page
+      for="zope.publisher.interfaces.INotFound"
+      name="index.html"
+      class=".exception.NotFound"
+      permission="zope.Public"
+      />
+
+  <browser:page
+      for="zExceptions.Unauthorized"
+      name="index.html"
+      class=".exception.Unauthorized"
+      permission="zope.Public"
+      />
+
 </configure>

Modified: Sandbox/philikon/five.publication/trunk/five/publication/exception.py
===================================================================
--- Sandbox/philikon/five.publication/trunk/five/publication/exception.py	2007-08-26 10:37:48 UTC (rev 79282)
+++ Sandbox/philikon/five.publication/trunk/five/publication/exception.py	2007-08-26 10:44:26 UTC (rev 79283)
@@ -11,3 +11,17 @@
 
     def __call__(self):
         self.request.response.redirect(self.context.args[0])
+
+class NotFound(BrowserPage):
+
+    def __call__(self):
+        self.request.response.setStatus(404)
+        self.request.response.setHeader('Content-Type', 'text/plain')
+        return 'Not found'
+
+class Unauthorized(BrowserPage):
+
+    def __call__(self):
+        self.request.response.setStatus(401)
+        self.request.response.setHeader('Content-Type', 'text/plain')
+        return 'Unauthorized'



More information about the Checkins mailing list