[Zope-dev] Re: RFC: Eggifying Zope's extension mechanism ("Products")

Philipp von Weitershausen philipp at weitershausen.de
Thu Jan 25 14:51:32 EST 2007


Rocky Burt wrote:
> On Thu, 2007-25-01 at 05:07 -0800, Martin Aspeli wrote:
>> I do wonder what would happen if you had both lib/python/Products/CMFCore
>> and Products/CMFCore, though. Would there be an explicit preference or would
>> Zope fail to start up with a conflict? I think I'd prefer the latter, in
>> fact, so that people don't end up modifying/upgrading the wrong code by
>> accident!
> 
> Well, we could probably add conflict-detection to the entry point
> handlers for Zope (ie so any two packages that try to register as the
> same project would cause an error).  But regarding Products/CMFCore and
> lib/python/Products/CMFCore conflicting... that would be up to the
> standard pythonpath mechanism of the python interpreter (whichever is
> first on the path wins).

Zope 2 itself manipulates Products.__path__ to add INSTANCE/Products (or 
any other directory specified in zope.conf) as a directory which can 
contain further products (the original Products package lives at 
ZOPE/lib/python/Products). pkg_resources uses the same mechanism for 
namespace packages (that's what the 
pkg_resources.declare_namespace('Products') call is all about); it 
appends to __path__.

Therefore, Zope will treat /path/to/the/CMFCore-egg/Products as another 
directory that contains a product (in this case just one, CMFCore). Thus 
the standard product override rules apply when the same product is 
installed in multiple directories.

I updated the proposal text with this information.

-- 
http://worldcookery.com -- Professional Zope documentation and training
Next Zope 3 training at Camp5: http://trizpug.org/boot-camp/camp5


More information about the Zope-Dev mailing list