src/ldt/ldt/utils/zipfileext.py
author cavaliet
Wed, 09 Mar 2011 18:42:58 +0100
changeset 44 20ab9a7f1849
parent 13 97ab7b3191cf
child 63 93325a5d61f0
permissions -rw-r--r--
update modal management for create project.

import zipfile, os, os.path

class ZipFileExt(zipfile.ZipFile):
    def unzip_into_dir(self, dir):
        if not os.path.exists(dir):
            os.mkdir(dir, 0777)
        for name in self.namelist():
            if name.endswith('/'):
                os.mkdir(os.path.join(dir, name))
            else:
                outfile = open(os.path.join(dir, name), 'wb')
                outfile.write(self.read(name))
                outfile.close()