[Zope3-dev] How to structure different related packages

Stephan Richter srichter at cosmos.phy.tufts.edu
Mon Oct 4 06:49:53 EDT 2004

On Sunday 03 October 2004 04:24, Florian Lindner wrote:
> Ok.
> I've now created my directory CS with the subdirs User and Event. It's
> working fine.

Note that all package names should be **lower** case, so


However, this seems already too deep, so you should have


> Now I want to add a ressource styles.css which should be used by all
> subpackages. I created a directory ressource, places the styles.css and
> a __init__.py in it and included it.
> First problem:
> My configure.zcml in ./ressources looks like that:
> <configure xmlns="http://namespaces.zope.org/zope">
>     <resource name="styles.css" file="styles.css" layer="centershock" />
> </configure>
> But zope is complaing about a missing type argument. apidoc says:
> *|type|* - |GlobalObject|
> <http://localhost:8080/++apidoc++/Class/zope/configuration/fields/GlobalObj
>ect/index.html> (required, default = |None|)

You have to use the `browser:resource` directive, not the `zope:resource` one, 
if you do not specify a type. The book clearly uses `browser:resource`:

<configure xmlns="http://namespaces.zope.org/browser">
    <resource name="styles.css" file="styles.css" layer="centershock" />

> could it be possiblee, that there is something wrong in your book? In
> http://dev.zope.org/Wikis/DevSite/Projects/ComponentArchitecture/Zope3Book/
>skin.html a ressource is included without specification of type

Nope, you just did not read it carefully enough.

> Next question: I also want to have a template which could be accessible
> from all packages with the standard
> metal:use-macro="views/standard_macros/..." Where to place and how to
> configure that, so that is available for all packages?

You probably want to provide your own macro set, so use a name like cs_macros 
or so. See the following files in `zope/app/rotterdam`: `configure.zcml`, 
`standardmacros.py`, `template.pt`, `dialog_macros` and `view_macros.pt`.

Stephan Richter
CBU Physics & Chemistry (B.S.) / Tufts Physics (Ph.D. student)
Web2k - Web Software Design, Development and Training

More information about the Zope3-dev mailing list