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

Philipp von Weitershausen philipp at weitershausen.de
Tue Sep 18 17:54:18 EDT 2007

Leonardo Rochael Almeida wrote:
> 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).

You seem to be quite sure of this. I can assert you, however, that 
you're wrong :).

Yes, self.context is the exception. But self.context.__parent__ will be 
the location that the error occurred with.

> 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.


I don't see the point. You could just as well call grok.getSite() to get 
it when you need it. It's about the same amount of effort and typing.

I don't really see the need for ErrorView.

http://worldcookery.com -- Professional Zope documentation and training

More information about the Grok-dev mailing list