The /@@/ resource view

I recently encountered a problem that I presume would be pretty common when creating a site based on the z3c.layer.minimal browser layer: the resources, although accessible as ++resource++resource_name, are not accessible at the default location used by packages as zc.resourcelibrary: http://localhost/site/@@/resource_name

The reason, as I have guessed, was that a certain page or view was missing, not being registered for the IMinimalLayer, which doesn't inherit from the IBrowserDefaultLayer. Grepping for "@@" didn't yield anything meaningful, and left me struggling to understand how zope deals with pages. While searching on how to register new browser menus, I've encountered the @@ view declaration and imediately saw what the problem was: its declaration doesn't include the "@" character! After I've added the following registration in my zcml files, the problem dissapeared and resourcelibrary resources were finally found at their proper location:

    <configure package="zope.app.publisher.browser">

        <!-- Solves the resources lookup problem /@@/ -->

        <page name="" for="zope.app.component.interfaces.ISite"
            class="zope.app.publisher.browser.resources.Resources"
            permission="zope.Public"
            allowed_interface="zope.publisher.interfaces.browser.IBrowserPublisher"
            layer="act.coursebuilder.layer.common.ICourseBuilderCommonLayer" />

    </configure>

Comments