[Zope3-Users] Problem creating custom z3c.pagelet error page
andrew
andrew at reurbanise.co.nz
Tue Jan 20 20:14:09 EST 2009
Hi Roger,
I finally got it sorted. The class providing the error handling needed
to implement our view marker interface, so the solution was:
class VortexNotFoundPagelet (NotFoundPagelet):
zope.interface.implements (IVortexBrowserView)
and:
<z3c:pagelet
name="index.html"
for="zope.publisher.interfaces.INotFound"
class=".VortexNotFoundPagelet"
layer="vortex.layer.IVortexBrowserLayer"
permission="zope.Public"
/>
<z3c:template
template="notfound.pt"
for=".VortexNotFoundPagelet"
layer="vortex.layer.IVortexBrowserLayer"
/>
I'm not sure if this will apply to anyone else, but I post it simply to
close the loop. And I should add that pagelets are very cool :-)
Cheers, Andrew.
On Wed, 2009-01-21 at 11:50 +1300, MyWebDNA Support wrote:
> Hi Roger,
>
> On Tue, 2009-01-20 at 23:03 +0100, Roger Ineichen wrote:
> > > <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.
>
> Thanks for this, Roger. I checked the default error pages in
> z3c.layer.pagelet.browser and that's how they are set up too. However, I
> tried this change and got exactly the same result. Even if I comment out
> all the error page stuff in my vortex.layer component it's like
> something else is affecting the default z3c.layer.pagelet.browser error
> handling. From what I can see from the tests, the default pagelet-based
> error pages should just work out of the box, correct ?
>
> > > 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.
>
> Cool, thanks for explaining that.
>
> Cheers, Andrew.
More information about the Zope3-users
mailing list