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

Martijn Faassen faassen at startifact.com
Tue Sep 18 15:56:27 EDT 2007


Leonardo Rochael Almeida wrote:
> Perhaps something like this would work (untested)?
> 
> class NotFound(grok.View):
>     grok.context(zope.publisher.interfaces.INotFound)
>     # or grok.context(zope.interface.common.interfaces.IException)
>     grok.name("index.html")
> 
>     [...]
> 
> At least the equivalent registrations above are the way to implement
> error views in Zope, according to the exception hook in the ZPublisher
> for 2.11. Didn't check how it is implemented in pure Zope3

Sometimes like this should indeed work.

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

Regards,

Martijn





More information about the Grok-dev mailing list