[BlueBream] Exception views, again

Michael Howitz mh at gocept.com
Mon Aug 9 02:42:47 EDT 2010

Am 07.08.2010 um 00:41 schrieb Justin Ryan:

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

Strange, I copied it directly from my ZCML file were I had tested it.

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

Yes. But it allows to create and use a package like z3c.layer.pagelet (which has "index.html" as default view name of the exceptions) in an application built in BB which uses "index" as default view name of all other views.

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

Really strange. I added my changed version to this e-mail. (I even tried to copy my ZCML code from above to a fresh copy of your unauth-test and it worked: when accessing a page which does not exists the browser shows: "login required")

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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: unauth.zip
Type: application/zip
Size: 39384 bytes
Desc: not available
Url : http://mail.zope.org/pipermail/bluebream/attachments/20100809/062e25d5/attachment-0001.zip 
-------------- next part --------------

Yours sincerely,
Michael Howitz ? mh at gocept.com ? software developer
gocept gmbh & co. kg ? forsterstra?e 29 ? 06112 halle (saale) ? germany
http://gocept.com ? tel +49 345 1229889 8 ? fax +49 345 1229889 1
Zope and Plone consulting and development

More information about the bluebream mailing list