[Zope] python product structure

Lennart Regebro regebro at gmail.com
Sun Jan 15 07:18:54 EST 2006


On 1/15/06, Carlos de la Guardia <carlos.delaguardia at gmail.com> wrote:
> First, here's more or less what everybody uses these days:
>
>  / MyProduct
>
> | __init__.py
> | config.py
> | MyProduct.py
> | utils.py
> / docs
> / zpt
> / www
>  / tests

Both zpt and www? I use only www or zmi for zmi support, and skins if
it's for CMF.
Although nowadays I try to use Five and hence use neither? ;-)

config.py and utils.py is not any type of standard, and people are
moving from the old MyProduct.py to myproduct.py, which is more
python-standard. I use /doc, not /docs, but maybe that's just me.

> I'm not sure whether to include a help directory anymore. Maybe I'm wrong,
> but I don't think many people use the Zope management help API.

No, you are right.

I would recommend:

/ MyProduct
 | __init__.py
 | MyProduct.py
 / doc
 / zmi
 / tests

for a Zope 2 product, with /skins added if it's CMF.

> But if one is going to work with Zope 2.8 and use Five, there is also this
> possibility, which also has some common elements with Plone/CMF structures:
>
>  / MyProduct
>
> | __init__.py
> | MyProduct.py
> | configure.zcml
> | browser.py
> | interfaces.py
> | utils.py
> / adapters
> / docs
> / skins
> / tests

Add /locales for translations and remove /skins which has nothing to
do in a Five product. It's a CMF thingy (of course you may have skins
in a Five product as well, but it's not a part of the Five, but CMF).
Here, it is a definite no-no to have capitalized file names, so it
should be myproduct.py. I don't know what utils.py does here either.

note that both adapters, browsers and interfaces can either be .py
files or directories, depending on if you have many of each or not.
:-) browser.py often does that, and besides, the browser-directory is
a good place to have the zpts.

So I would say:

/ MyProduct
 | __init__.py
 | myproduct.py
 | configure.zcml
 | interfaces.py
 / browser
   | __init__.py
   | configure.zcml
   | aview.py
   | aview.pt
 / doc
 / tests
 / locales

with adapters.py added if you have many adapters, and interfaces.py
and adapters.py be made into directories if they grow big.

--
Lennart Regebro, Nuxeo     http://www.nuxeo.com/
CPS Content Management     http://www.cps-project.org/


More information about the Zope mailing list