[Zope-CMF] Adding python packages to ProductsPath

Wichert Akkerman wichert at wiggy.net
Tue Jan 23 04:56:41 EST 2007


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
there.

Are there any objections to commiting this to trunk?

Wichert.

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') ]
 
+
 security.declarePublic('expandpath')
 def expandpath(p):
     """ Convert minimal filepath to (expanded) filepath.


-- 
Wichert Akkerman <wichert at wiggy.net>    It is simple to make things.
http://www.wiggy.net/                   It is hard to make things simple.


More information about the Zope-CMF mailing list