plone buildout and Products namespace

Martin Aspeli optilude at gmx.net
Thu Oct 18 00:53:34 UTC 2007


Martin Aspeli wrote:

>> products =
>>     ${buildout:directory}/Products <-- notice the capital P
>>     ${productdistros:location}/Products
>>     ${plone:products}/Products

...

>> Would people be interested in such changes to the recipes and to the
>> ZopeSkel template?
> 
> This sounds like a good idea. The only problem I see is that quite a lot 
> of documentation (including, selfishly, my book) assumes the lowercase p 
> in ${buildout:directory}/products. It probably isn't a huge deal to 
> change it, but it would be a bit annoying.

Thinking about this some more - does it really matter that the parent 
directory for everything on the Product-path is "Products" with a 
capital P and has an __init__.py that declares a namespace package?

Right now, the way the plone3_buildout layout works, we have a 
'products' directory (lowercase p) with no __init__.py at all, on the 
productpath and it works just fine. I don't see why adding an 
__init__.py would make much difference at all.

As far as I understand it, the thing that matters is that the first 
'Products' that's found on the PYTHONPATH/sys.path has the necessary 
namespace package declarations inside its __init__.py. Zope itself does 
things like "import Products" (there are even some module level 
variables in $SOFTWARE_HOME/Products/__init__.py) and it's definitely a 
good idea if the namespace declaration goes there, but this doesn't 
really apply to other things on the product-path (which is scanned by 
Zope at a much lower level anyway).

I don't think it even makes a difference to the plone.recipe.distros 
case. Again, we have an arbitrary directory which we put on the 
product-path; this isn't on sys.path and isn't imported in any way. It 
doesn't have an __init__.py either.

I may be wrong though. But if I'm not, then I'm -1 on your proposal, 
since it'd be changing stuff that's documented and which people are 
using right now in a way that makes it more confusing (multiple 
plone.recipe.distro parts would use the same directory, adding 
__init__.py makes this look like a package when it's not) and 
inconsistent (everything else in the buildout uses lowercase directory 
names) for no actual beenfit.

Martin

-- 
Author of `Professional Plone Development`, a book for developers who
want to work with Plone. See http://martinaspeli.net/plone-book





More information about the Product-Developers mailing list