[BlueBream] Exception views, again

Justin Ryan jryan at reliefgarden.org
Fri Aug 6 18:41:03 EDT 2010


On Tue, Aug 3, 2010 at 11:29 PM, Michael Howitz <mh at gocept.com> wrote:

>
> Your declaration is correct but it misses the default view declaration:
>
>  <browser:defaultView
>      name="index"
>      for="zope.publisher.interfaces.INotFound"
>      layer="unauth.welcome.interfaces.ISampleApplicationBrowserLayer"
>      />
>

I got an invalid token here, but another question below..

> The reason is that on error the default view of the exception is looked up. When it is not found the default "template" is used. See zope/app/publication/zopepublication.py around line 370
>
>                name = queryDefaultViewName(exception, request)
>                if name is not None:
>                    view = zope.component.queryMultiAdapter(
>                        (exception, request), name=name)
>
> This requirement might be confusing but it allows the exception views to have other view names than the rest of the application.
>

So, even though the BB paster template already declares "index" as the
default view for all content, I have to do this for the Exception?  It
is clear that the notion of an exception view is kind of wierder than
normal views.

I actually thought some of the docs I saw might smell like that, but
trying your sample directive above isn't working.

I am actively working in the STX docs right now and promise to produce
some really clear documentation on our discussion, thanks to all
who've responded.

I have to admit I'm a bit spoiled coming from Plone, even though I
have well over five years of experience and have hacked on ZTK a bit,
every once in a while I just realize there is something I never
learned how to do, like throw a freaking login page for Unauthorized,
or a custom 404.  Alan Runyan always told me that I was doing this to
myself, but I had customers so, yanno. ;)

Best,

J


More information about the bluebream mailing list