def new_zip(self, filename, deleted_files=None, new_files={}):
if self.zipmodule == <NUM_LIT:2>:<EOL><INDENT>from reston.patch import zipfile<EOL>zout = zipfile.ZipFile(filename, '<STR_LIT:w>')<EOL><DEDENT>else:<EOL><INDENT>import zipfile<EOL>zout = zipfile.ZipFile(filename, '<STR_LIT:w>')<EOL><DEDENT>for item in self.zip.infolist():<EOL><INDENT>if deleted_files is not None:<EOL><INDENT>if re.match(deleted_files, item.filename) == None:<EOL><INDENT>if item.filename in new_files:<EOL><INDENT>zout.writestr(item, new_files[item.filename])<EOL><DEDENT>else:<EOL><INDENT>buffer = self.zip.read(item.filename)<EOL>zout.writestr(item, buffer)<EOL><DEDENT><DEDENT><DEDENT><DEDENT>zout.close()<EOL>
Create a new zip file

:param filename: the output filename of the zip
:param deleted_files: a regex pattern to remove specific file
:param new_files: a dictionnary of new files

:type filename: string
:type deleted_files: None or a string
:type new_files: a dictionnary (key:filename, value:content of the file)