def unzip(file_obj):
 files = []
 zip = ZipFile(file_obj)
 bad_file = zip.testzip()
 if bad_file:
  raise Exception(('"%s" in the .zip archive is corrupt.' % bad_file))
 infolist = zip.infolist()
 for zipinfo in infolist:
  if zipinfo.filename.startswith('__'):
   continue
  file_obj = SimpleUploadedFile(name=zipinfo.filename, content=zip.read(zipinfo))
  files.append((file_obj, zipinfo.filename))
 zip.close()
 return files

def unzip ( file_obj ) : files = [ ] zip = ZipFile ( file_obj ) bad_file = zip . testzip ( ) if bad_file : raise Exception ( ( '"%s" in the .zip archive is corrupt.' % bad_file ) ) infolist = zip . infolist ( ) for zipinfo in infolist : if zipinfo . filename . startswith ( '__' ) : continue file_obj = SimpleUploadedFile ( name = zipinfo . filename , content = zip . read ( zipinfo ) ) files . append ( ( file_obj , zipinfo . filename ) ) zip . close ( ) return files
extract the contents of the zip file filename into the directory root .