Re: Customizing the Zope 404 page
Wichert Akkerman <[email protected]>
| Newsgroups | gmane.comp.web.zope.plone.devel |
|---|---|
| Message-ID | <[email protected]> |
On 03 Jun 2014, at 04:11, Laurence Rowe <[email protected]> wrote: > On 2 June 2014 17:02, Elizabeth Leddy <[email protected]> wrote: > Greetings Ploners! > > I have been digging in very, very deep dark zope code and was wondering if anyone knows or has a link on how to customize Zope’s 404 page? This is super helpful for hosting many plone sites in one zope instance and the current not found doesn’t even have the right page type. > > I think you can register an exception view too. I can't find an example for this but the code looking them up is here: https://github.com/zopefoundation/Zope/blob/41c2220b9aa5727367760dd7d34e4b342d6c2d11/src/Zope2/App/startup.py#L241 and this code here: https://github.com/zopefoundation/Zope/blob/41c2220b9aa5727367760dd7d34e4b342d6c2d11/src/Zope2/App/tests/testExceptionHook.py#L298 > > Ah, here it is, from http://old.zope.org/Products/Zope/2.11.2/CHANGES.txt/ You can also do this without any zcml: from five import grok import zExceptions class NotFound(grok.View): grok.context(zExceptions.NotFound) grok.name("index.html") grok.template("error_notfound”) This is the general exception view system, so you can do this for all errors. For example use Exception instead of zExceptions.NotFound and you’ll have a generic error view. The grok.name bit may not be necessary - I needed that for a site where I completely disable the Plone UI. Wichert. ------------------------------------------------------------------------------ Learn Graph Databases - Download FREE O'Reilly Book "Graph Databases" is the definitive new guide to graph databases and their applications. Written by three acclaimed leaders in the field, this first edition is now available. Download your free book today! http://p.sf.net/sfu/NeoTech _______________________________________________ Plone-developers mailing list Plone-developers-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org https://lists.sourceforge.net/lists/listinfo/plone-developers