diff --git a/lib/tfw/components/source_code_event_handler.py b/lib/tfw/components/source_code_event_handler.py index 4b6662c..6afcf63 100644 --- a/lib/tfw/components/source_code_event_handler.py +++ b/lib/tfw/components/source_code_event_handler.py @@ -14,7 +14,7 @@ LOG = logging.getLogger(__name__) class FileManager: # pylint: disable=too-many-instance-attributes - def __init__(self, working_directory, allowed_directories=None, selected_file=None, exclude=None): + def __init__(self, working_directory, allowed_directories, selected_file=None, exclude=None): self._exclude, self.exclude = None, exclude self._allowed_directories, self.allowed_directories = None, allowed_directories self._workdir, self.workdir = None, working_directory @@ -40,9 +40,8 @@ class FileManager: # pylint: disable=too-many-instance-attributes def workdir(self, directory): if not exists(directory) or not isdir(directory): raise EnvironmentError('"{}" is not a directory!'.format(directory)) - if self.allowed_directories: - if not self._is_whitelisted(directory): - raise EnvironmentError('Directory "{}" is not in whitelist!'.format(directory)) + if not self._is_whitelisted(directory): + raise EnvironmentError('Directory "{}" is not in whitelist!'.format(directory)) self._workdir = directory @property @@ -92,7 +91,7 @@ class FileManager: # pylint: disable=too-many-instance-attributes class SourceCodeEventHandler(TriggerlessEventHandler): # pylint: disable=too-many-arguments - def __init__(self, key, directory, allowed_directories=None, selected_file=None, exclude=None): + def __init__(self, key, directory, allowed_directories, selected_file=None, exclude=None): super().__init__(key) self.filemanager = FileManager(allowed_directories=allowed_directories, working_directory=directory, selected_file=selected_file, exclude=exclude)