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)