Archive için bir deneme...
tests içerisindekileri unittest'e taşımayı ciddi ciddi düşünüyoruz (şimdilik sadece düşünüyoruz...)
This commit is contained in:
+11
-3
@@ -2,14 +2,19 @@
|
|||||||
# maintainer: baris and meren
|
# maintainer: baris and meren
|
||||||
|
|
||||||
import tarfile
|
import tarfile
|
||||||
|
import zipfile
|
||||||
|
|
||||||
import config
|
import config
|
||||||
|
|
||||||
class ArchiveTarFile:
|
class ArchiveBase(object):
|
||||||
def __init__(self, filename, type):
|
def __init__(self, filename, type):
|
||||||
self.type = type
|
self.type = type
|
||||||
self.filename = filename
|
self.filename = filename
|
||||||
|
|
||||||
|
class ArchiveTarFile(ArchiveBase):
|
||||||
|
def __init__(self, filename, type):
|
||||||
|
super(ArchiveTarFile, self).__init__(filename, type)
|
||||||
|
|
||||||
def unpack(self):
|
def unpack(self):
|
||||||
if self.type == "targz":
|
if self.type == "targz":
|
||||||
tar = tarfile.open(config.archives_dir()+"/"+self.filename, 'r:gz')
|
tar = tarfile.open(config.archives_dir()+"/"+self.filename, 'r:gz')
|
||||||
@@ -17,9 +22,12 @@ class ArchiveTarFile:
|
|||||||
tar.extract(tarinfo)
|
tar.extract(tarinfo)
|
||||||
tar.close()
|
tar.close()
|
||||||
|
|
||||||
class ArchiveZip:
|
class ArchiveZip(ArchiveBase):
|
||||||
pass
|
def __init__(self, filename, type):
|
||||||
|
super(ArchiveZip, self).__init__(filename, type)
|
||||||
|
|
||||||
|
def unpack(self):
|
||||||
|
print "lolo"
|
||||||
|
|
||||||
class Archive:
|
class Archive:
|
||||||
"""Unpack magic for Archive files..."""
|
"""Unpack magic for Archive files..."""
|
||||||
|
|||||||
Reference in New Issue
Block a user