add field 'excludeDirectories' to limit search to directory specified by address

git-svn-id: svn://svn.cy55.de/Zope3/src/loops/trunk@3186 fd906abe-77d9-0310-91a1-e0d9ade77398
This commit is contained in:
helmutm 2009-01-29 07:43:59 +00:00
parent 40b8182f06
commit f83df2e8a8
2 changed files with 9 additions and 1 deletions

View file

@ -124,6 +124,8 @@ class DirectoryCollectionProvider(object):
directory = self.getDirectory(client)
pattern = re.compile(client.pattern or '.*')
for path, dirs, files in os.walk(directory):
if client.excludeDirectories:
del dirs[:]
if '.svn' in dirs:
del dirs[dirs.index('.svn')]
for ex in client.exclude:

View file

@ -68,9 +68,15 @@ class IExternalCollection(IConceptSchema):
description=_(u'A regular expression for selecting external objects '
u'that should belong to this collection'),
required=False)
excludeDirectories = schema.Bool(
title=_(u'Exclude directories'),
description=_(u'Check this if only object directly at the specified '
u'address should be included in the collection.'),
default=False,
required=False)
exclude = schema.List(
title=_(u'Exclude'),
description=_(u'Names of directories and files that should not '
description=_(u'Names of objects (directories and files) that should not '
u'be included.'),
value_type=schema.TextLine(),
required=False)