Wichert Akkerman wrote:
At the moment it is not possible to use skin layers in pure python
packages. This is caused by the DirectoryView implementation using
a minimal path name for the layer id. This path name is created
by CMFCore.utils.minimalpath, which uses the ProductsPaths list of
directories to look for the filesystem directory and uses an absolute
path if it can't find it. Since this absolute path will differ per
install you can't use it in something like genericsetup profiles.

The patch below fixes this by adding $INSTANCE_HOME/lib/python to the
ProductsPaths list. This allows minimalpath to find python packages installed

Are there any objections to commiting this to trunk?

I don't have any actual objections, but I find looking at Products.__path__ a bit lame and way too close-minded, to be honest. Your suggested addition doesn't make it better since you're broadening the scope just a little bit. What about packages installed somewhere else than instance/lib/python? The idea of using Python packages, after all, is that they can be installed *anywhere* on the PYTHONPATH. The whole thing would already break if a package would be installed as an egg, even it was installed into lib/python.

The Right Thing(tm) IMO would be look at Zope's own products registry and inspect that for directories in which to look for skins. This would also be a future proof solution should http://wiki.zope.org/zope2/EggifyingZopesExtensionMechanismQuotProductsQuot be implemented.


Index: utils.py
--- utils.py    (revision 72192)
+++ utils.py    (working copy)
@@ -719,8 +719,10 @@
     return os_path.normpath(p.replace('\\','/')).replace('\\','/')
import Products
-ProductsPath = [ abspath(ppath) for ppath in Products.__path__ ]
+ProductsPath = [ abspath(ppath) for ppath in Products.__path__ ] + \
+    [ os_path.join(INSTANCE_HOME, 'lib', 'python') ]
 def expandpath(p):
     """ Convert minimal filepath to (expanded) filepath.

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

Zope-CMF maillist  -  Zope-CMF@lists.zope.org

See http://collector.zope.org/CMF for bug reports and feature requests

Reply via email to