Remove fs_cleanup file_descriptor argument

Signed-off-by: Roberto Rosario <roberto.rosario@mayan-edms.com>
This commit is contained in:
Roberto Rosario
2019-07-26 15:16:54 -04:00
parent 85b05dd6ec
commit c05dcf5b05

View File

@@ -22,13 +22,10 @@ def NamedTemporaryFile(*args, **kwargs):
return tempfile.NamedTemporaryFile(*args, **kwargs)
def fs_cleanup(filename, file_descriptor=None, suppress_exceptions=True):
def fs_cleanup(filename, suppress_exceptions=True):
"""
Tries to remove the given filename. Ignores non-existent files
Tries to remove the given filename. Ignores non-existent files.
"""
if file_descriptor:
os.close(file_descriptor)
try:
os.remove(filename)
except OSError:
@@ -63,6 +60,12 @@ def get_storage_subclass(dotted_path):
def mkdtemp(*args, **kwargs):
"""
Creates a temporary directory in the most secure manner possible.
There are no race conditions in the directorys creation.
The directory is readable, writable, and searchable only by the creating
user ID.
"""
kwargs.update({'dir': setting_temporary_directory.value})
return tempfile.mkdtemp(*args, **kwargs)