Index: /main/waeup.sirp/trunk/src/waeup/sirp/browser/exceptions.py
===================================================================
--- /main/waeup.sirp/trunk/src/waeup/sirp/browser/exceptions.py	(revision 6192)
+++ /main/waeup.sirp/trunk/src/waeup/sirp/browser/exceptions.py	(revision 6192)
@@ -0,0 +1,87 @@
+##
+## exceptions.py
+## Login : <uli@pu.smp.net>
+## Started on  Sun May 22 18:28:46 2011 Uli Fouquet
+## $Id$
+## 
+## Copyright (C) 2011 Uli Fouquet
+## This program is free software; you can redistribute it and/or modify
+## it under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 2 of the License, or
+## (at your option) any later version.
+## 
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+## GNU General Public License for more details.
+## 
+## You should have received a copy of the GNU General Public License
+## along with this program; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##
+import grok
+from megrok.layout import Page
+from zope.interface.common.interfaces import IException
+from zope.publisher.interfaces import INotFound
+from zope.security.interfaces import IUnauthorized
+from waeup.sirp.browser.layout import SiteLayout, WAeUPPage
+from waeup.sirp.interfaces import IWAeUPObject
+
+grok.templatedir('templates')
+
+class ExceptionLayout(SiteLayout):
+    """ The general site layout.
+    """
+    grok.context(IException)
+    grok.template('sitelayout')
+
+
+#class ExceptionPage(WAeUPPage):
+#    grok.context(IException)
+#    grok.name('index.html')
+#    grok.template('exception')
+#
+#    title = u'System Error'
+#    pnav = 0
+#
+#    def update(self):
+#        # XXX: That's merely bullshit. We cannot trust to have anything
+#        # ready/setup if some arbitrary exception happens. Maybe we're
+#        # better off with views instead pages here?
+#        self.message = self.context.message
+#        self.args = self.context.args
+#        self.error_context = self.context
+#        if not IWAeUPObject.providedBy(self.context):
+#            self.context = self.context = getattr(
+#                self.context, '__parent__', self.context)
+#            self.context = self.context.context
+#        return
+
+
+class UnauthorizedPage(WAeUPPage):
+    grok.context(IUnauthorized)
+    grok.name('index.html')
+    grok.template('unauthorized')
+
+    title = u'Unauthorized'
+
+    def update(self):
+        self.error_context = self.context
+        forbidden_view = self.context.args[0]
+        self.context = forbidden_view.context
+        pass
+
+class NotFoundPage(WAeUPPage):
+    grok.context(INotFound)
+    grok.name('index.html')
+    grok.template('notfound')
+
+    title = u'404: File Not Found'
+
+    def update(self):
+        try:
+            self.context = self.context.getObject()
+        except:
+            pass
+        self.response.setStatus(404)
+        return
