| author | verrierj |
| Wed, 18 Jan 2012 16:29:02 +0100 | |
| changeset 415 | 4236f99104ba |
| parent 63 | 93325a5d61f0 |
| child 1190 | 129d45eec68c |
| permissions | -rw-r--r-- |
| 63 | 1 |
import zipfile |
2 |
import os.path |
|
| 0 | 3 |
|
4 |
class ZipFileExt(zipfile.ZipFile): |
|
5 |
def unzip_into_dir(self, dir): |
|
6 |
if not os.path.exists(dir): |
|
7 |
os.mkdir(dir, 0777) |
|
8 |
for name in self.namelist(): |
|
9 |
if name.endswith('/'): |
|
|
13
97ab7b3191cf
add api to update project, uses psiton
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
10 |
os.mkdir(os.path.join(dir, name)) |
| 0 | 11 |
else: |
|
13
97ab7b3191cf
add api to update project, uses psiton
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
12 |
outfile = open(os.path.join(dir, name), 'wb') |
| 0 | 13 |
outfile.write(self.read(name)) |
14 |
outfile.close() |
|
15 |