[CMF-checkins] CVS: CMF/CMFCore - DirectoryView.py:1.29 utils.py:1.30
Chris Withers
chrisw@nipltd.com
Mon, 19 Aug 2002 13:30:02 -0400
Update of /cvs-repository/CMF/CMFCore
In directory cvs.zope.org:/tmp/cvs-serv9522/CMFCore
Modified Files:
DirectoryView.py utils.py
Log Message:
Merge from branch:
1. Make tests using FSDV's work on a copy of the fake skin in the temporary fiel space.
2. 2nd attempt at making DV dirpaths be a bit mroe flexible in cross platform situations
3. All tests should now pass on both Windows and Linux.
=== CMF/CMFCore/DirectoryView.py 1.28 => 1.29 ===
--- CMF/CMFCore/DirectoryView.py:1.28 Mon Aug 12 08:23:13 2002
+++ CMF/CMFCore/DirectoryView.py Mon Aug 19 13:29:32 2002
@@ -47,7 +47,6 @@
in listdir(path)
if name not in ignore ]
-# This walker is only used on the Win32 version of _changed
def _walker (listdir, dirname, names):
names = [ (name, stat(path.join(dirname,name))[8])
for name
@@ -150,7 +149,7 @@
prm[permission]=(acquire,roles)
return prm
- if Globals.DevelopmentMode and os.name=='nt':
+ if Globals.DevelopmentMode:
def _changed(self):
mtime=0
@@ -178,16 +177,6 @@
return 0
- elif Globals.DevelopmentMode:
-
- def _changed(self):
- try: mtime = stat(expandpath(self.filepath))[8]
- except: mtime = 0
- if mtime != self._v_last_read:
- self._v_last_read = mtime
- return 1
- return 0
-
else:
def _changed(self):
@@ -348,7 +337,7 @@
def getDirectoryInfo(self, filepath):
# Can return None.
- return self._directories.get(os.path.normpath(filepath), None)
+ return self._directories.get(minimalpath(filepath), None)
def listDirectories(self):
dirs = self._directories.keys()
=== CMF/CMFCore/utils.py 1.29 => 1.30 ===
--- CMF/CMFCore/utils.py:1.29 Mon Aug 12 08:23:13 2002
+++ CMF/CMFCore/utils.py Mon Aug 19 13:29:32 2002
@@ -607,7 +607,7 @@
#
security.declarePublic('normalize')
def normalize(p):
- return os_path.abspath(os_path.normcase(os_path.normpath(p)))
+ return os_path.abspath(os_path.normcase(os_path.normpath(p.replace('\\','/'))))
normINSTANCE_HOME = normalize(INSTANCE_HOME)
normSOFTWARE_HOME = normalize(SOFTWARE_HOME)
@@ -627,16 +627,16 @@
security.declarePublic('minimalpath')
def minimalpath(p):
- # Trims INSTANCE_HOME or SOFTWARE_HOME from a path.
- p = os_path.abspath(p)
- abs = normalize(p)
- l = len(normINSTANCE_HOME)
- if abs[:l] != normINSTANCE_HOME:
- l = len(normSOFTWARE_HOME)
- if abs[:l] != normSOFTWARE_HOME:
- # Can't minimize.
- return p
- p = p[l:]
+ # This trims down to a 'Products' root if it can.
+ # otherwise, it returns what it was given.
+ # In either case, the path is normalized.
+ p = normalize(p)
+ index = p.find('Products')
+ if index == -1:
+ index = p.find('products')
+ if index == -1:
+ return p
+ p = p[index:]
while p[:1] in separators:
p = p[1:]
return p