summaryrefslogtreecommitdiff
path: root/fs/zipfs.py
diff options
context:
space:
mode:
authorwillmcgugan <willmcgugan@67cdc799-7952-0410-af00-57a81ceafa0f>2010-11-07 17:18:50 +0000
committerwillmcgugan <willmcgugan@67cdc799-7952-0410-af00-57a81ceafa0f>2010-11-07 17:18:50 +0000
commitc73ab0891377d813ff459e2f9d7b953a3817f85f (patch)
treef8b9a0f732ac38e18ce6ade266f12478dd2964c0 /fs/zipfs.py
parent9f3cc97b77ef71ae0937a428797a5cb48a7db20c (diff)
downloadpyfilesystem-c73ab0891377d813ff459e2f9d7b953a3817f85f.tar.gz
Added getmeta and hasmeta methods
git-svn-id: http://pyfilesystem.googlecode.com/svn/trunk@526 67cdc799-7952-0410-af00-57a81ceafa0f
Diffstat (limited to 'fs/zipfs.py')
-rw-r--r--fs/zipfs.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/fs/zipfs.py b/fs/zipfs.py
index db41af0..000e87a 100644
--- a/fs/zipfs.py
+++ b/fs/zipfs.py
@@ -7,6 +7,7 @@ A FS object that represents the contents of a Zip file
"""
import datetime
+import os.path
from fs.base import *
from fs.path import *
@@ -67,6 +68,12 @@ class _ExceptionProxy(object):
class ZipFS(FS):
"""A FileSystem that represents a zip file."""
+
+ _meta = { 'virtual' : False,
+ 'read_only' : False,
+ 'unicode_paths' : os.path.supports_unicode_filenames,
+ 'case_insensitive_paths' : os.path.normcase('Aa') == 'aa',
+ }
def __init__(self, zip_file, mode="r", compression="deflated", allow_zip_64=False, encoding="CP437", thread_synchronize=True):
"""Create a FS that maps on to a zip file.
@@ -115,6 +122,8 @@ class ZipFS(FS):
self._path_fs = MemoryFS()
if mode in 'ra':
self._parse_resource_list()
+
+ self._meta['read_only'] = self.zip_mode != 'w'
def __str__(self):
return "<ZipFS: %s>" % self.zip_path
@@ -138,7 +147,6 @@ class ZipFS(FS):
f = self._path_fs.open(path, 'w')
f.close()
-
def close(self):
"""Finalizes the zip file so that it can be read.
No further operations will work after this method is called."""