From f83df2e8a8242ede18426a19b713446e0f010c23 Mon Sep 17 00:00:00 2001 From: helmutm Date: Thu, 29 Jan 2009 07:43:59 +0000 Subject: [PATCH] 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 --- integrator/collection.py | 2 ++ integrator/interfaces.py | 8 +++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/integrator/collection.py b/integrator/collection.py index 1ab8bf1..880dcda 100644 --- a/integrator/collection.py +++ b/integrator/collection.py @@ -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: diff --git a/integrator/interfaces.py b/integrator/interfaces.py index 32e9b16..d535d87 100644 --- a/integrator/interfaces.py +++ b/integrator/interfaces.py @@ -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)