Package glass :: Package vfs :: Module Zip :: Class Zip
[show private | hide private]
[frames | no frames]

Class Zip


This is a vfs class for zip files.

The following attributes are used:

root
This is the name of the zip file.
zip
This is a zipfile.ZipFile instance for working with the zip.

Known bugs:

If you think of a zip file as a filesystem, there is no path to represent the root of the filesystem as a directory. It'd be nice to add code to treat "" as the root of the filesystem.


Method Summary
  __init__(self, root)
Set the name of the zip file.
  __getattr__(self, attr)
Delegate methods.
  __repr__(self)
  exists(self, path)
Test whether a path exists.
  isdir(self, path)
Test whether a path is a directory.
  isfile(self, path)
Test whether a path is a regular file.
  open(self, name, mode_ignored, buffering_ignored)
Open a file.
  stat(self, path)
Return a stat for the given path.
  translate_path(self, path)
Translate path to the local filename syntax.

Method Details

__init__(self, root)
(Constructor)

Set the name of the zip file.

If this isn't a zip file, raise a ValueError.

__getattr__(self, attr)
(Qualification operator)

Delegate methods.

The following methods are delegated:

join, splitext, splitdrive, split, curdir, pardir

I delegate them to posixpath instead of os.path because I want posixpath behavior even if the user is using Windows.

exists(self, path)

Test whether a path exists.

isdir(self, path)

Test whether a path is a directory.

isfile(self, path)

Test whether a path is a regular file.

open(self, name, mode_ignored='', buffering_ignored='')

Open a file.

stat(self, path)

Return a stat for the given path.

The stat that I'm capable of returning is very stripped. It only has the two attributes st_mtime and st_size.

translate_path(self, path)

Translate path to the local filename syntax.

Actually, path is already in the local filename syntax, but this is your last chance to do anything else, such as making it an absolute path, etc.


Generated by Epydoc 2.1 on Mon Jan 1 16:36:34 2007 http://epydoc.sf.net