Changeset 6199


Ignore:
Timestamp:
26 May 2011, 21:59:52 (13 years ago)
Author:
uli
Message:

Add an always working Unauthorized view.

File:
1 edited

Legend:

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

    r6192 r6199  
    2121##
    2222import grok
     23import zope.errorview.browser
    2324from megrok.layout import Page
    2425from zope.interface.common.interfaces import IException
     
    5859#        return
    5960
     61class UnauthorizedView(grok.View, zope.errorview.browser.UnauthorizedView):
     62    """Base class for rendering views for IUnauthorized exceptions.
    6063
    61 class UnauthorizedPage(WAeUPPage):
     64    Backport from grok 1.6. This is only a view (not a page) because
     65    we cannot trust that the associated :exc:`Unauthorized` exceptions
     66    happened inside a w.s. site.
     67
     68    If not, then we have no layout available at time of rendering.
     69
     70    XXX: This view is shared for all apps and objects in the ZODB root.
     71    """
    6272    grok.context(IUnauthorized)
    6373    grok.name('index.html')
    6474    grok.template('unauthorized')
    6575
    66     title = u'Unauthorized'
     76    def update(self):
     77        return zope.errorview.browser.UnauthorizedView.update(self)
    6778
    68     def update(self):
    69         self.error_context = self.context
    70         forbidden_view = self.context.args[0]
    71         self.context = forbidden_view.context
    72         pass
    7379
    7480class NotFoundPage(WAeUPPage):
Note: See TracChangeset for help on using the changeset viewer.