Changeset 6201


Ignore:
Timestamp:
26 May 2011, 22:56:39 (13 years ago)
Author:
uli
Message:

Provide (improvable) error views.

Location:
main/waeup.sirp/trunk/src/waeup/sirp/browser
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.sirp/trunk/src/waeup/sirp/browser/exceptions.py

    r6199 r6201  
    2222import grok
    2323import zope.errorview.browser
    24 from megrok.layout import Page
    2524from zope.interface.common.interfaces import IException
     25from zope.errorview.http import SystemErrorViewMixin
    2626from zope.publisher.interfaces import INotFound
    2727from zope.security.interfaces import IUnauthorized
    28 from waeup.sirp.browser.layout import SiteLayout, WAeUPPage
    29 from waeup.sirp.interfaces import IWAeUPObject
     28from waeup.sirp.browser.layout import WAeUPPage
    3029
    3130grok.templatedir('templates')
    3231
    33 class ExceptionLayout(SiteLayout):
    34     """ The general site layout.
     32class ExceptionView(grok.View, zope.errorview.browser.ExceptionView,
     33                    SystemErrorViewMixin):
     34    """Base class for rendering views for uncaught exceptions that occur during
     35    the application run-time and are not otherwise rendered.
     36
     37    Backport from Grok 1.6.
     38
     39    XXX: This view is shared for all apps and objects in the ZODB root.
    3540    """
    3641    grok.context(IException)
    37     grok.template('sitelayout')
     42    grok.name('index.html')
     43    grok.template('exception')
    3844
    39 
    40 #class ExceptionPage(WAeUPPage):
    41 #    grok.context(IException)
    42 #    grok.name('index.html')
    43 #    grok.template('exception')
    44 #
    45 #    title = u'System Error'
    46 #    pnav = 0
    47 #
    48 #    def update(self):
    49 #        # XXX: That's merely bullshit. We cannot trust to have anything
    50 #        # ready/setup if some arbitrary exception happens. Maybe we're
    51 #        # better off with views instead pages here?
    52 #        self.message = self.context.message
    53 #        self.args = self.context.args
    54 #        self.error_context = self.context
    55 #        if not IWAeUPObject.providedBy(self.context):
    56 #            self.context = self.context = getattr(
    57 #                self.context, '__parent__', self.context)
    58 #            self.context = self.context.context
    59 #        return
     45    def update(self):
     46        return zope.errorview.browser.ExceptionView.update(self)
    6047
    6148class UnauthorizedView(grok.View, zope.errorview.browser.UnauthorizedView):
     
    7966
    8067class NotFoundPage(WAeUPPage):
     68    """A page rendered when an object cannot be found.
     69
     70    XXX: This page won't work for objects above a w.s.University.
     71    """
    8172    grok.context(INotFound)
    8273    grok.name('index.html')
  • main/waeup.sirp/trunk/src/waeup/sirp/browser/templates/unauthorized.pt

    r6191 r6201  
    1 <div class="warning">
    2   <b>You are not authorized to access this resource.</b>
    3 </div>
     1<html xmlns="http://www.w3.org/1999/xhtml">
     2  <head>
     3    <title>Not Authorized</title>
     4  </head>
     5  <body>
     6    <div class="warning">
     7      <b>You are not authorized to access this resource.</b>
     8    </div>
     9  </body>
     10</html>
Note: See TracChangeset for help on using the changeset viewer.