[CMF-checkins] CVS: CMF/CMFCore - DirectoryView.py:1.19
Shane Hathaway
shane@cvs.zope.org
Tue, 29 Jan 2002 10:55:08 -0500
Update of /cvs-repository/CMF/CMFCore
In directory cvs.zope.org:/tmp/cvs-serv3753
Modified Files:
DirectoryView.py
Log Message:
Fixed the problems with the DirectoryView tests by allowing a path instead
of a globals dictionary to be passed to the directory registration
mechanism, then using absolute paths.
=== CMF/CMFCore/DirectoryView.py 1.18 => 1.19 ===
from zLOG import LOG, ERROR
from sys import exc_info
+from types import StringType
_dtmldir = os.path.join( package_home( globals() ), 'dtml' )
@@ -256,8 +257,10 @@
def getTypeByMetaType(self, mt):
return self._meta_types.get(mt, None)
- def registerDirectory(self, name, parent_globals, subdirs=1):
- filepath = path.join(package_home(parent_globals), name)
+ def registerDirectory(self, name, _prefix, subdirs=1):
+ if not isinstance(_prefix, StringType):
+ _prefix = package_home(_prefix)
+ filepath = path.join(_prefix, name)
self.registerDirectoryByPath(filepath, subdirs)
def registerDirectoryByPath(self, filepath, subdirs=1):
@@ -438,7 +441,7 @@
ob = DirectoryView(id, filepath)
parent._setObject(id, ob)
-def addDirectoryViews(ob, name, parent_globals):
+def addDirectoryViews(ob, name, _prefix):
'''
Adds a directory view for every subdirectory of the
given directory.
@@ -447,7 +450,9 @@
# Note that registerDirectory() still needs to be called
# by product initialization code to satisfy
# persistence demands.
- fp = path.join(package_home(parent_globals), name)
+ if not isinstance(_prefix, StringType):
+ _prefix = package_home(_prefix)
+ fp = path.join(_prefix, name)
filepath = minimalpath(fp)
info = _dirreg.getDirectoryInfo(filepath)
if info is None: