mirror of
https://github.com/avatao-content/baseimage-tutorial-framework
synced 2024-11-09 02:37:17 +00:00
Refactor file manager
This commit is contained in:
parent
f495ff2d7c
commit
a69031015b
@ -16,7 +16,7 @@ LOG = logging.getLogger(__name__)
|
||||
|
||||
class FileManager: # pylint: disable=too-many-instance-attributes
|
||||
def __init__(self, working_directory, allowed_directories, selected_file=None, exclude=None):
|
||||
self._exclude, self.exclude = None, exclude
|
||||
self._exclude, self.exclude = [], exclude
|
||||
self._allowed_directories, self.allowed_directories = None, allowed_directories
|
||||
self._workdir, self.workdir = None, working_directory
|
||||
self._filename, self.filename = None, selected_file or self.files[0]
|
||||
@ -91,7 +91,8 @@ class FileManager: # pylint: disable=too-many-instance-attributes
|
||||
|
||||
def _is_blacklisted(self, file):
|
||||
return any(
|
||||
fnmatchcase(file, blacklisted)
|
||||
fnmatchcase(file, blacklisted) or
|
||||
fnmatchcase(basename(file), blacklisted)
|
||||
for blacklisted in self.exclude
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user