<s> import os <EOL> from django . core . files . uploadedfile import SimpleUploadedFile <EOL> from image_filer . utils import zipfile <EOL> def unzip ( file ) : <EOL> """<STR_LIT>""" <EOL> files = [ ] <EOL> zip = zipfile . ZipFile ( file ) <EOL> bad_file = zip . testzip ( ) <EOL> if bad_file : <EOL> raise Exception ( '<STR_LIT>' % bad_file ) <EOL> infolist = zip . infolist ( ) <EOL> print infolist <EOL> for zipinfo in infolist : <EOL> print "<STR_LIT>" % zipinfo . filename <EOL> if zipinfo . filename . startswith ( '<STR_LIT>' ) : <EOL> continue <EOL> thefile = SimpleUploadedFile ( name = zipinfo . filename , content = zip . read ( zipinfo ) ) <EOL> files . append ( ( thefile , zipinfo . filename ) ) <EOL> zip . close ( ) <EOL> return files </s>
