Back to index

moin  1.9.0~rc2
Public Member Functions | Public Attributes
MoinMoin.support.tarfile.TarFileCompat Class Reference

List of all members.

Public Member Functions

def __init__
def namelist
def infolist
def printdir
def testzip
def getinfo
def read
def write
def writestr
def close

Public Attributes

 tarfile

Detailed Description

TarFile class compatible with standard module zipfile's
   ZipFile class.

Definition at line 2128 of file tarfile.py.


Constructor & Destructor Documentation

def MoinMoin.support.tarfile.TarFileCompat.__init__ (   self,
  file,
  mode = "r",
  compression = TAR_PLAIN 
)

Definition at line 2132 of file tarfile.py.

02132 
02133     def __init__(self, file, mode="r", compression=TAR_PLAIN):
02134         if compression == TAR_PLAIN:
02135             self.tarfile = TarFile.taropen(file, mode)
02136         elif compression == TAR_GZIPPED:
02137             self.tarfile = TarFile.gzopen(file, mode)
02138         else:
02139             raise ValueError("unknown compression constant")
02140         if mode[0:1] == "r":
02141             members = self.tarfile.getmembers()
02142             for m in members:
02143                 m.filename = m.name
02144                 m.file_size = m.size
                m.date_time = time.gmtime(m.mtime)[:6]

Member Function Documentation

Definition at line 2170 of file tarfile.py.

02170 
02171     def close(self):
02172         self.tarfile.close()
02173 #class TarFileCompat
02174 
02175 #--------------------
02176 # exported functions
#--------------------

Here is the caller graph for this function:

Definition at line 2154 of file tarfile.py.

02154 
02155     def getinfo(self, name):
        return self.tarfile.getmember(name)

Definition at line 2147 of file tarfile.py.

02147 
02148     def infolist(self):
02149         return filter(lambda m: m.type in REGULAR_TYPES,
                      self.tarfile.getmembers())

Here is the caller graph for this function:

Definition at line 2145 of file tarfile.py.

02145 
02146     def namelist(self):
        return map(lambda m: m.name, self.infolist())

Here is the call graph for this function:

Definition at line 2150 of file tarfile.py.

02150 
02151     def printdir(self):
        self.tarfile.list()
def MoinMoin.support.tarfile.TarFileCompat.read (   self,
  name 
)

Definition at line 2156 of file tarfile.py.

02156 
02157     def read(self, name):
        return self.tarfile.extractfile(self.tarfile.getmember(name)).read()

Here is the caller graph for this function:

Definition at line 2152 of file tarfile.py.

02152 
02153     def testzip(self):
        return
def MoinMoin.support.tarfile.TarFileCompat.write (   self,
  filename,
  arcname = None,
  compress_type = None 
)

Definition at line 2158 of file tarfile.py.

02158 
02159     def write(self, filename, arcname=None, compress_type=None):
        self.tarfile.add(filename, arcname)

Here is the caller graph for this function:

def MoinMoin.support.tarfile.TarFileCompat.writestr (   self,
  zinfo,
  bytes 
)

Definition at line 2160 of file tarfile.py.

02160 
02161     def writestr(self, zinfo, bytes):
02162         try:
02163             from cStringIO import StringIO
02164         except ImportError:
02165             from StringIO import StringIO
02166         import calendar
02167         zinfo.name = zinfo.filename
02168         zinfo.size = zinfo.file_size
02169         zinfo.mtime = calendar.timegm(zinfo.date_time)
        self.tarfile.addfile(zinfo, StringIO(bytes))

Member Data Documentation

Definition at line 2134 of file tarfile.py.


The documentation for this class was generated from the following file: