[Zope3-Users] Problem creating custom z3c.pagelet error page

Roger Ineichen dev at projekt01.ch
Tue Jan 20 17:03:32 EST 2009



Regards
Roger Ineichen
_____________________________
END OF MESSAGE
  

> -----Ursprüngliche Nachricht-----
> Von: zope3-users-bounces at zope.org 
> [mailto:zope3-users-bounces at zope.org] Im Auftrag von andrew
> Gesendet: Dienstag, 20. Januar 2009 22:54
> An: zope3-users at zope.org
> Betreff: [Zope3-Users] Problem creating custom z3c.pagelet error page
> 
> Hi All,
> 
> I'm having a problem setting up a custom error page using the 
> z3c.pagelet approach, which I'm using successfully for other 
> pages in my app. I've tried configuring my error pages as such:
> 
> 	<z3c:pagelet
> 	    name="index.html"
> 	    for="zope.publisher.interfaces.INotFound"
> 	    class="z3c.layer.pagelet.browser.NotFoundPagelet"
> 	    layer="vortex.layer.IVortexBrowserLayer"
> 	    permission="zope.Public"
> 	    />
> 
> 	<z3c:template
> 	    template="notfound.pt"
> 	    for="zope.publisher.interfaces.INotFound"
> 	    layer="vortex.layer.IVortexBrowserLayer"
> 	    />

Try to register the template for the class:
z3c.layer.pagelet.browser.NotFoundPagelet

instead of for the:
zope.publisher.interfaces.INotFound

The INotFound interface doesn't need a template, but the
pagelet class needs one.

e.g.

<z3c:template
  template="notfound.pt"
  for="z3c.layer.pagelet.browser.NotFoundPagelet"
  layer="vortex.layer.IVortexBrowserLayer"
  />

> but when I trigger, e.g., a not found error I get:
> 
> 2009-01-21T10:45:43 ERROR SiteError Exception while rendering 
> view on exception Traceback (most recent call last):
>   File
> "/opt/vortex/buildout/vortex/var/eggs/zope.app.publication-3.4
> .2-py2.4.egg/zope/app/publication/zopepublication.py", line 
> 335, in handleException
>     body = mapply(view, (), request)
>   File
> "/opt/vortex/buildout/vortex/var/eggs/zope.publisher-3.4.1-py2
.4.egg/zope/publisher/publish.py", line 108, in mapply
>     return debug_call(obj, args)
>    - __traceback_info__: <z3c.pagelet.zcml.NotFoundPagelet object at
> 0x9e6148c>
>   File
> "/opt/vortex/buildout/vortex/var/eggs/zope.publisher-3.4.1-py2
.4.egg/zope/publisher/publish.py", line 114, in debug_call
>     return obj(*args)
>   File
> "/opt/vortex/buildout/vortex/var/eggs/z3c.pagelet-1.0.0-py2.4.
egg/z3c/pagelet/browser.py", line 55, in __call__
>     ILayoutTemplate)
>   File
> "/opt/vortex/buildout/vortex/var/eggs/zope.component-3.4.0-py2
.4.egg/zope/component/_api.py", line 103, in getMultiAdapter
>     raise ComponentLookupError(objects, interface, name)
> ComponentLookupError: ((<z3c.pagelet.zcml.NotFoundPagelet object at
> 0x9e6148c>, <zc.resourcelibrary.publication.Request instance
> URL=http://wgp.reurbanise.geek.nz/fred>), <InterfaceClass 
> z3c.template.interfaces.ILayoutTemplate>, u'')
> 
> 
> But z3c.pagelet.zcml.NotFoundPagelet doesn't exist as far as 
> I can see.
> Any ideas what's happening here ? Much appreciated.

The z3c:pagelet register via zcml a new class based on your
class attribute NotFoundPagelet given from
z3c.layer.pagelet.browser.

This is the same as the <browser:page> directive does.

Don't worry about this. That's correct.

Regards
Roger Ineichen

> Cheers, Andrew.
> 
> 
> 
> _______________________________________________
> Zope3-users mailing list
> Zope3-users at zope.org
> http://mail.zope.org/mailman/listinfo/zope3-users
> 



More information about the Zope3-users mailing list