[Grok-dev] How do I mimick the standard_error_page of Zope 2.x?

Leonardo Rochael Almeida leorochael at gmail.com
Tue Sep 18 16:48:47 EDT 2007


This was actually meant for the list.

---------- Forwarded message ----------
From: Leonardo Rochael Almeida <leorochael at gmail.com>
Date: Sep 18, 2007 5:47 PM
Subject: Re: [Grok-dev] Re: How do I mimick the standard_error_page of Zope 2.x?
To: Martijn Faassen <faassen at startifact.com>


On 9/18/07, Martijn Faassen <faassen at startifact.com> wrote:
> Leonardo Rochael Almeida wrote:
> > [...]
> > Perhaps Grok could grow a grok.ErrorView base class that would already
> > set the grok.name("index.html")
>
> Hm, an interesting idea. If that's all the weight grok.ErrorView is
> pulling though, I wonder how hard it would be to let the error mechanism
> look up views named 'index' instead.

Not sure, but I do know that there are some other things ErrorView
could do. An exception view is just a multiadapter for (<exception
instance>, <request>) and depending on your exception instance (say, a
KeyError), you'll end up with very little information about your
situation. For instance, the ".context" of this view certainly won't
have any idea of location (in the ILocation sense).

I'd sugest that, at the very least, an ErrorView instance have a .site
attribute taken from zope.app.component.hooks.getSite() or a more
appropriate equivalent.

Cheers, Leo


More information about the Grok-dev mailing list