Commit 3bff875f authored by 's avatar

merged in Evans product lookup update

parent 21ee43e6
...@@ -86,11 +86,12 @@ __doc__='''Standard routines for handling extensions. ...@@ -86,11 +86,12 @@ __doc__='''Standard routines for handling extensions.
Extensions currently include external methods and pluggable brains. Extensions currently include external methods and pluggable brains.
$Id: Extensions.py,v 1.12 1999/11/08 17:09:27 brian Exp $''' $Id: Extensions.py,v 1.13 2000/06/26 19:52:46 brian Exp $'''
__version__='$Revision: 1.12 $'[11:-2] __version__='$Revision: 1.13 $'[11:-2]
from string import find, split from string import find, split
import os, zlib, rotor import os, zlib, rotor
import Products
path_split=os.path.split path_split=os.path.split
path_join=os.path.join path_join=os.path.join
exists=os.path.exists exists=os.path.exists
...@@ -149,16 +150,17 @@ def getPath(prefix, name, checkProduct=1, suffixes=('',)): ...@@ -149,16 +150,17 @@ def getPath(prefix, name, checkProduct=1, suffixes=('',)):
if d: raise ValueError, ( if d: raise ValueError, (
'The file name, %s, should be a simple file name' % name) 'The file name, %s, should be a simple file name' % name)
sw=path_split(path_split(SOFTWARE_HOME)[0])[0]
for home in (INSTANCE_HOME, sw):
if checkProduct: if checkProduct:
l=find(name, '.') l = find(name, '.')
if l > 0: if l > 0:
p=name[:l] p = name[:l]
n=name[l+1:] n = name[l + 1:]
r=_getPath(home, "lib/python/Products/%s/%s/" % (p,prefix), for product_dir in Products.__path__:
n, suffixes) r = _getPath(product_dir, '%s/%s/' % (p, prefix), n, suffixes)
if r is not None: return r if r is not None: return r
sw=path_split(path_split(SOFTWARE_HOME)[0])[0]
for home in (INSTANCE_HOME, sw):
r=_getPath(home, prefix, name, suffixes) r=_getPath(home, prefix, name, suffixes)
if r is not None: return r if r is not None: return r
......
...@@ -307,9 +307,7 @@ class Product(Folder, PermissionManager): ...@@ -307,9 +307,7 @@ class Product(Folder, PermissionManager):
manage_readme=Globals.HTMLFile('readme',globals()) manage_readme=Globals.HTMLFile('readme',globals())
def manage_get_product_readme__(self): def manage_get_product_readme__(self):
try: try:
return open(os.path.join( return open(os.path.join(self.home, 'README.txt')).read()
SOFTWARE_HOME, 'Products', self.id,'README.txt'
)).read()
except: return '' except: return ''
def permissionMappingPossibleValues(self): def permissionMappingPossibleValues(self):
...@@ -437,6 +435,7 @@ def initializeProduct(productp, name, home, app): ...@@ -437,6 +435,7 @@ def initializeProduct(productp, name, home, app):
product.manage_options=Folder.manage_options product.manage_options=Folder.manage_options
product.icon='p_/InstalledProduct_icon' product.icon='p_/InstalledProduct_icon'
product.version=fver product.version=fver
product.home=home
product._distribution=None product._distribution=None
product.manage_distribution=None product.manage_distribution=None
product.thisIsAnInstalledProduct=1 product.thisIsAnInstalledProduct=1
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment