# Path: image_filer/utils/zipfile.py
# class BadZipfile(Exception):
# class LargeZipFile(Exception):
# class ZipInfo (object):
# class _ZipDecrypter:
# class ZipExtFile:
# class ZipFile:
# class PyZipFile(ZipFile):
# ZIP64_LIMIT = (1 << 31) - 1
# ZIP_FILECOUNT_LIMIT = 1 << 16
# ZIP_MAX_COMMENT = (1 << 16) - 1
# ZIP_STORED = 0
# ZIP_DEFLATED = 8
# _ECD_SIGNATURE = 0
# _ECD_DISK_NUMBER = 1
# _ECD_DISK_START = 2
# _ECD_ENTRIES_THIS_DISK = 3
# _ECD_ENTRIES_TOTAL = 4
# _ECD_SIZE = 5
# _ECD_OFFSET = 6
# _ECD_COMMENT_SIZE = 7
# _ECD_COMMENT = 8
# _ECD_LOCATION = 9
# _CD_SIGNATURE = 0
# _CD_CREATE_VERSION = 1
# _CD_CREATE_SYSTEM = 2
# _CD_EXTRACT_VERSION = 3
# _CD_EXTRACT_SYSTEM = 4
# _CD_FLAG_BITS = 5
# _CD_COMPRESS_TYPE = 6
# _CD_TIME = 7
# _CD_DATE = 8
# _CD_CRC = 9
# _CD_COMPRESSED_SIZE = 10
# _CD_UNCOMPRESSED_SIZE = 11
# _CD_FILENAME_LENGTH = 12
# _CD_EXTRA_FIELD_LENGTH = 13
# _CD_COMMENT_LENGTH = 14
# _CD_DISK_NUMBER_START = 15
# _CD_INTERNAL_FILE_ATTRIBUTES = 16
# _CD_EXTERNAL_FILE_ATTRIBUTES = 17
# _CD_LOCAL_HEADER_OFFSET = 18
# _FH_SIGNATURE = 0
# _FH_EXTRACT_VERSION = 1
# _FH_EXTRACT_SYSTEM = 2
# _FH_GENERAL_PURPOSE_FLAG_BITS = 3
# _FH_COMPRESSION_METHOD = 4
# _FH_LAST_MOD_TIME = 5
# _FH_LAST_MOD_DATE = 6
# _FH_CRC = 7
# _FH_COMPRESSED_SIZE = 8
# _FH_UNCOMPRESSED_SIZE = 9
# _FH_FILENAME_LENGTH = 10
# _FH_EXTRA_FIELD_LENGTH = 11
# _CD64_SIGNATURE = 0
# _CD64_DIRECTORY_RECSIZE = 1
# _CD64_CREATE_VERSION = 2
# _CD64_EXTRACT_VERSION = 3
# _CD64_DISK_NUMBER = 4
# _CD64_DISK_NUMBER_START = 5
# _CD64_NUMBER_ENTRIES_THIS_DISK = 6
# _CD64_NUMBER_ENTRIES_TOTAL = 7
# _CD64_DIRECTORY_SIZE = 8
# _CD64_OFFSET_START_CENTDIR = 9
#             CRC = compress_size = file_size = 0
#             CRC = self.CRC
#             CRC = crc32(buf, CRC) & 0xffffffff
#     USAGE=textwrap.dedent("""\
#         Usage:
#             zipfile.py -l zipfile.zip        # Show listing of a zipfile
#             zipfile.py -t zipfile.zip        # Test if a zipfile is valid
#             zipfile.py -e zipfile.zip target # Extract zipfile into target dir
#             zipfile.py -c zipfile.zip src ... # Create zipfile from sources
#         """)
# def _check_zipfile(fp):
# def is_zipfile(filename):
# def _EndRecData64(fpin, offset, endrec):
# def _EndRecData(fpin):
#     def __init__(self, filename="NoName", date_time=(1980,1,1,0,0,0)):
#     def FileHeader(self):
#     def _encodeFilenameFlags(self):
#     def _decodeFilename(self):
#     def _decodeExtra(self):
#     def _GenerateCRCTable():
#     def _crc32(self, ch, crc):
#     def __init__(self, pwd):
#     def _UpdateKeys(self, c):
#     def __call__(self, c):
#     def __init__(self, fileobj, zipinfo, decrypt=None):
#     def set_univ_newlines(self, univ_newlines):
#     def __iter__(self):
#     def next(self):
#     def close(self):
#     def _checkfornewline(self):
#     def readline(self, size = -1):
#     def readlines(self, sizehint = -1):
#     def read(self, size = None):
#     def __init__(self, file, mode="r", compression=ZIP_STORED, allowZip64=False):
#     def _GetContents(self):
#     def _RealGetContents(self):
#     def namelist(self):
#     def infolist(self):
#     def printdir(self):
#     def testzip(self):
#     def getinfo(self, name):
#     def setpassword(self, pwd):
#     def read(self, name, pwd=None):
#     def open(self, name, mode="r", pwd=None):
#     def extract(self, member, path=None, pwd=None):
#     def extractall(self, path=None, members=None, pwd=None):
#     def _extract_member(self, member, targetpath, pwd):
#     def _writecheck(self, zinfo):
#     def write(self, filename, arcname=None, compress_type=None):
#     def writestr(self, zinfo_or_arcname, bytes):
#     def __del__(self):
#     def close(self):
#     def writepy(self, pathname, basename = ""):
#     def _get_codename(self, pathname, basename):
# def main(args = None):
#         def addToZip(zf, path, zippath):


import os
from django.core.files.uploadedfile import SimpleUploadedFile
from image_filer.utils import zipfile
#import zipfile
# zipfile.open() is only available in Python 2.6, so we use the future version

def unzip(file):
    """
    Take a path to a zipfile and checks if it is a valid zip file
    and returns...
    """
    files = []
    # TODO: implement try-except here

# Path: image_filer/utils/zipfile.py
# class BadZipfile(Exception):
# class LargeZipFile(Exception):
# class ZipInfo (object):
# class _ZipDecrypter:
# class ZipExtFile:
# class ZipFile:
# class PyZipFile(ZipFile):
# ZIP64_LIMIT = (1 << 31) - 1
# ZIP_FILECOUNT_LIMIT = 1 << 16
# ZIP_MAX_COMMENT = (1 << 16) - 1
# ZIP_STORED = 0
# ZIP_DEFLATED = 8
# _ECD_SIGNATURE = 0
# _ECD_DISK_NUMBER = 1
# _ECD_DISK_START = 2
# _ECD_ENTRIES_THIS_DISK = 3
# _ECD_ENTRIES_TOTAL = 4
# _ECD_SIZE = 5
# _ECD_OFFSET = 6
# _ECD_COMMENT_SIZE = 7
# _ECD_COMMENT = 8
# _ECD_LOCATION = 9
# _CD_SIGNATURE = 0
# _CD_CREATE_VERSION = 1
# _CD_CREATE_SYSTEM = 2
# _CD_EXTRACT_VERSION = 3
# _CD_EXTRACT_SYSTEM = 4
# _CD_FLAG_BITS = 5
# _CD_COMPRESS_TYPE = 6
# _CD_TIME = 7
# _CD_DATE = 8
# _CD_CRC = 9
# _CD_COMPRESSED_SIZE = 10
# _CD_UNCOMPRESSED_SIZE = 11
# _CD_FILENAME_LENGTH = 12
# _CD_EXTRA_FIELD_LENGTH = 13
# _CD_COMMENT_LENGTH = 14
# _CD_DISK_NUMBER_START = 15
# _CD_INTERNAL_FILE_ATTRIBUTES = 16
# _CD_EXTERNAL_FILE_ATTRIBUTES = 17
# _CD_LOCAL_HEADER_OFFSET = 18
# _FH_SIGNATURE = 0
# _FH_EXTRACT_VERSION = 1
# _FH_EXTRACT_SYSTEM = 2
# _FH_GENERAL_PURPOSE_FLAG_BITS = 3
# _FH_COMPRESSION_METHOD = 4
# _FH_LAST_MOD_TIME = 5
# _FH_LAST_MOD_DATE = 6
# _FH_CRC = 7
# _FH_COMPRESSED_SIZE = 8
# _FH_UNCOMPRESSED_SIZE = 9
# _FH_FILENAME_LENGTH = 10
# _FH_EXTRA_FIELD_LENGTH = 11
# _CD64_SIGNATURE = 0
# _CD64_DIRECTORY_RECSIZE = 1
# _CD64_CREATE_VERSION = 2
# _CD64_EXTRACT_VERSION = 3
# _CD64_DISK_NUMBER = 4
# _CD64_DISK_NUMBER_START = 5
# _CD64_NUMBER_ENTRIES_THIS_DISK = 6
# _CD64_NUMBER_ENTRIES_TOTAL = 7
# _CD64_DIRECTORY_SIZE = 8
# _CD64_OFFSET_START_CENTDIR = 9
#             CRC = compress_size = file_size = 0
#             CRC = self.CRC
#             CRC = crc32(buf, CRC) & 0xffffffff
#     USAGE=textwrap.dedent("""\
#         Usage:
#             zipfile.py -l zipfile.zip        # Show listing of a zipfile
#             zipfile.py -t zipfile.zip        # Test if a zipfile is valid
#             zipfile.py -e zipfile.zip target # Extract zipfile into target dir
#             zipfile.py -c zipfile.zip src ... # Create zipfile from sources
#         """)
# def _check_zipfile(fp):
# def is_zipfile(filename):
# def _EndRecData64(fpin, offset, endrec):
# def _EndRecData(fpin):
#     def __init__(self, filename="NoName", date_time=(1980,1,1,0,0,0)):
#     def FileHeader(self):
#     def _encodeFilenameFlags(self):
#     def _decodeFilename(self):
#     def _decodeExtra(self):
#     def _GenerateCRCTable():
#     def _crc32(self, ch, crc):
#     def __init__(self, pwd):
#     def _UpdateKeys(self, c):
#     def __call__(self, c):
#     def __init__(self, fileobj, zipinfo, decrypt=None):
#     def set_univ_newlines(self, univ_newlines):
#     def __iter__(self):
#     def next(self):
#     def close(self):
#     def _checkfornewline(self):
#     def readline(self, size = -1):
#     def readlines(self, sizehint = -1):
#     def read(self, size = None):
#     def __init__(self, file, mode="r", compression=ZIP_STORED, allowZip64=False):
#     def _GetContents(self):
#     def _RealGetContents(self):
#     def namelist(self):
#     def infolist(self):
#     def printdir(self):
#     def testzip(self):
#     def getinfo(self, name):
#     def setpassword(self, pwd):
#     def read(self, name, pwd=None):
#     def open(self, name, mode="r", pwd=None):
#     def extract(self, member, path=None, pwd=None):
#     def extractall(self, path=None, members=None, pwd=None):
#     def _extract_member(self, member, targetpath, pwd):
#     def _writecheck(self, zinfo):
#     def write(self, filename, arcname=None, compress_type=None):
#     def writestr(self, zinfo_or_arcname, bytes):
#     def __del__(self):
#     def close(self):
#     def writepy(self, pathname, basename = ""):
#     def _get_codename(self, pathname, basename):
# def main(args = None):
#         def addToZip(zf, path, zippath):


# Path: image_filer/utils/zip.py
import os
from django.core.files.uploadedfile import SimpleUploadedFile
from image_filer.utils import zipfile

#import zipfile
# zipfile.open() is only available in Python 2.6, so we use the future version

def unzip(file):
    """
    Take a path to a zipfile and checks if it is a valid zip file
    and returns...
    """
    files = []
    # TODO: implement try-except here

    zip = zipfile.ZipFile(file)