41
41
FILE_SUFFIX = '.weave'
43
43
def __init__(self, transport, prefixed=False, precious=False,
44
dir_mode=None, file_mode=None):
44
dir_mode=None, file_mode=None, escaped=False):
45
45
super(WeaveStore, self).__init__(transport,
46
46
dir_mode=dir_mode, file_mode=file_mode,
47
prefixed=prefixed, compressed=False)
47
prefixed=prefixed, compressed=False, escaped=escaped)
48
48
self._precious = precious
50
50
def filename(self, file_id):
51
51
"""Return the path relative to the transport root."""
53
return hash_prefix(file_id) + urllib.quote(file_id) + WeaveStore.FILE_SUFFIX
55
return urllib.quote(file_id) + WeaveStore.FILE_SUFFIX
52
return self._relpath(file_id) + WeaveStore.FILE_SUFFIX
57
54
def __iter__(self):
58
55
l = len(WeaveStore.FILE_SUFFIX)
59
56
for relpath in self._iter_files_recursive():
60
57
if relpath.endswith(WeaveStore.FILE_SUFFIX):
61
yield os.path.basename(relpath[:-l])
58
path = os.path.basename(relpath[:-l])
60
yield urllib.unquote(path)
63
64
def has_id(self, fileid):
64
65
return self._transport.has(self.filename(fileid))