[CMF-checkins] CVS: CMF/CMFCore - DirectoryView.py:1.26

Chris Withers chrisw@nipltd.com
Mon, 5 Aug 2002 06:46:54 -0400


Update of /cvs-repository/CMF/CMFCore
In directory cvs.zope.org:/tmp/cvs-serv24201/CMFCore

Modified Files:
	DirectoryView.py 
Log Message:
More robustly test the FS Security stuff, also check even harder that stuff has been modified in a driectory view on Windows.

=== CMF/CMFCore/DirectoryView.py 1.25 => 1.26 ===
 from sys import exc_info
 from types import StringType
 
-_dtmldir = os.path.join( package_home( globals() ), 'dtml' )
+_dtmldir = path.join( package_home( globals() ), 'dtml' )
 
 __reload_module__ = 0
 
 # Ignore version control subdirectories
-# and special names.
-def _filter(name):
-    return name not in ('CVS', 'SVN', '.', '..')
+ignore = ('CVS', 'SVN', '.', '..')
 
+# and special names.
 def _filtered_listdir(path):
-    n = filter(_filter,
-               listdir(path))
-    return n
+    return [ name
+             for name
+             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[:]=filter(_filter,names)
+    names = [ (name, stat(path.join(dirname,name))[8])
+              for name
+              in names
+              if name not in ignore ]
     listdir.extend(names)
 
 class DirectoryInformation:
@@ -166,7 +169,7 @@
                     ERROR,
                     'Error checking for directory modification',
                     error=exc_info())
-                
+
             if mtime != self._v_last_read or filelist != self._v_last_filelist:
                 self._v_last_read = mtime
                 self._v_last_filelist = filelist