diff options
author | btimby <btimby@67cdc799-7952-0410-af00-57a81ceafa0f> | 2012-03-12 21:25:52 +0000 |
---|---|---|
committer | btimby <btimby@67cdc799-7952-0410-af00-57a81ceafa0f> | 2012-03-12 21:25:52 +0000 |
commit | 83370fc4a72c63b5af57d457b67dc00b7515ee42 (patch) | |
tree | b4f08bcf28985783e81404eeccdd70a851293605 /fs/contrib | |
parent | f4896c9829aaa66215e096bd6fba3d8e3fce4148 (diff) | |
download | pyfilesystem-git-83370fc4a72c63b5af57d457b67dc00b7515ee42.tar.gz |
Support opening the archive directly
Diffstat (limited to 'fs/contrib')
-rw-r--r-- | fs/contrib/archivefs.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/fs/contrib/archivefs.py b/fs/contrib/archivefs.py index b820030..cb6cd77 100644 --- a/fs/contrib/archivefs.py +++ b/fs/contrib/archivefs.py @@ -98,6 +98,9 @@ class ArchiveFS(FS): @synchronize def open(self, path, mode="r", **kwargs): path = normpath(relpath(path)) + if path == '': + # We need to open the archive itself, not one of it's entries. + return file(self.root_path, mode) if 'a' in mode: raise Exception('Unsupported mode ' + mode) if 'r' in mode: @@ -114,7 +117,7 @@ class ArchiveFS(FS): f = self.open(path) return f.read() - def desc(self, path): + def desc(self, path): return "%s in zip file" % path def getsyspath(self, path, allow_none=False): |