Commit 1812a70f authored by Gabriel Monnerat's avatar Gabriel Monnerat

refactor code to remove zipfile only if it is replaced by another file

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk/utils@41911 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 8dc4c6c3
......@@ -75,6 +75,7 @@ class FileSystemDocument(object):
zip_filename_list = zipfile.namelist()
if 'mimetype' not in zip_filename_list and \
'[Content_Types].xml' not in zip_filename_list:
zipfile_path = file_path
zipfile.extractall(path=self.directory_name)
zipfile.close()
filename_list = listdir(self.directory_name)
......@@ -86,6 +87,8 @@ class FileSystemDocument(object):
if mimetypes.guess_type(filename)[0] in mimetype_list:
file_path = join(self.directory_name, filename)
break
if zipfile_path != file_path:
remove(zipfile_path)
return file_path
def getContent(self, zip=False):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment