[CMF-checkins] CVS: CMF/CMFCore - DirectoryView.py:1.37
Andy McKay
andy@agmweb.ca
Fri, 14 Mar 2003 16:15:07 -0500
Update of /cvs-repository/CMF/CMFCore
In directory cvs.zope.org:/tmp/cvs-serv29953
Modified Files:
DirectoryView.py
Log Message:
Add a filter to ignore backups, #50
=== CMF/CMFCore/DirectoryView.py 1.36 => 1.37 ===
--- CMF/CMFCore/DirectoryView.py:1.36 Wed Mar 12 00:06:28 2003
+++ CMF/CMFCore/DirectoryView.py Fri Mar 14 16:15:07 2003
@@ -33,6 +33,7 @@
from sys import exc_info
from types import StringType
from FSMetadata import FSMetadata
+import re
_dtmldir = path.join( package_home( globals() ), 'dtml' )
@@ -40,6 +41,8 @@
# Ignore version control subdirectories
ignore = ('CVS', 'SVN', '.', '..', '.svn')
+# Ignore suspected backups and hidden files
+ignore_re = re.compile(r'\.|(.*~$)|#')
# and special names.
def _filtered_listdir(path):
@@ -52,7 +55,7 @@
names = [ (name, stat(path.join(dirname,name))[8])
for name
in names
- if name not in ignore ]
+ if name not in ignore and not ignore_re.match(name) ]
listdir.extend(names)
class DirectoryInformation: