예제 #1
0
class ZipHandler(object):
    def __init__(self, path):
        self.path = path
        self.zip = ZipFile(self.path, "r")

    def list_files(self, sub_path):
        if sub_path:
            return
        return self.zip.namelist()
        # for name in self.zip.namelist():
        #     #if name.endswith(str("/")):
        #     #if name.endswith("/"):
        #     #    continue
        #     #yield self.decode_name(name)
        #     yield name

    def open(self, name):
        return self.zip.open(name)

    def exists(self, name):
        try:
            self.zip.getinfo(name)
        except KeyError:
            return False
        else:
            return True
예제 #2
0
class ZipHandler(object):
    def __init__(self, path):
        self.path = path
        self.zip = ZipFile(self.path, "r")

    def list_files(self, sub_path):
        if sub_path:
            return
        return self.zip.namelist()
        # for name in self.zip.namelist():
        #     #if name.endswith(str("/")):
        #     #if name.endswith("/"):
        #     #    continue
        #     #yield self.decode_name(name)
        #     yield name

    def open(self, name):
        return self.zip.open(name)

    def exists(self, name):
        try:
            self.zip.getinfo(name)
        except KeyError:
            return False
        else:
            return True
예제 #3
0
class ZipHandler(object):
    def __init__(self, path):
        self.path = path
        self.zip = ZipFile(self.path, "r")

    def list_files(self, sub_path):
        if sub_path:
            return
        return self.zip.namelist()

    def open(self, name):
        return self.zip.open(name)

    def exists(self, name):
        try:
            self.zip.getinfo(name)
        except KeyError:
            return False
        else:
            return True
예제 #4
0
 def __init__(self, path):
     self.path = path
     self.zip = ZipFile(self.path, "r")
예제 #5
0
 def __init__(self, path):
     self.path = path
     self.zip = ZipFile(self.path, "r")