[BlueBream] Exception views, again
Michael Howitz
mh at gocept.com
Wed Aug 4 02:29:02 EDT 2010
Am 04.08.2010 um 00:26 schrieb Justin Ryan:
> Hiya..
[snipped some details]
> And, the Unauthorized view:
>
> <browser:page
> for="zope.exceptions.IUnauthorized"
> name="index"
> permission="zope.Public"
> template="unauth.pt"
> layer="unauth.welcome.interfaces.ISampleApplicationBrowserLayer"
> />
Your declaration is correct but it misses the default view declaration:
<browser:defaultView
name="index"
for="zope.publisher.interfaces.INotFound"
layer="unauth.welcome.interfaces.ISampleApplicationBrowserLayer"
/>
The reason is that on error the default view of the exception is looked up. When it is not found the default "template" is used. See zope/app/publication/zopepublication.py around line 370
name = queryDefaultViewName(exception, request)
if name is not None:
view = zope.component.queryMultiAdapter(
(exception, request), name=name)
This requirement might be confusing but it allows the exception views to have other view names than the rest of the application.
Yours sincerely,
--
Michael Howitz · mh at gocept.com · software developer
gocept gmbh & co. kg · forsterstraße 29 · 06112 halle (saale) · germany
http://gocept.com · tel +49 345 1229889 8 · fax +49 345 1229889 1
Zope and Plone consulting and development
More information about the bluebream
mailing list