def ilistdirinfo(self, path="/", wildcard=None, full=False, absolute=False, dirs_only=False, files_only=False): self._log(DEBUG, "Listing directory (listdirinfo) %s" % path) if dirs_only and files_only: raise ValueError("dirs_only and files_only can not both be True") for item in self.tahoeutil.list(self.dircap, path): if dirs_only and item['type'] == 'filenode': continue elif files_only and item['type'] == 'dirnode': continue if wildcard is not None: if isinstance(wildcard,basestring): if not fnmatch.fnmatch(item['name'], wildcard): continue else: if not wildcard(item['name']): continue if full: item_path = relpath(pathjoin(path, item['name'])) elif absolute: item_path = abspath(pathjoin(path, item['name'])) else: item_path = item['name'] yield (item_path, item)
def listdirinfo(self, path="/", wildcard=None, full=False, absolute=False, dirs_only=False, files_only=False): self.wrapped_fs._log(DEBUG, "Listing directory (listdirinfo) %s" % path) _fixpath = self.wrapped_fs._fixpath _path = _fixpath(path) if dirs_only and files_only: raise errors.ValueError("dirs_only and files_only can not both be True") result = [] for item in self.wrapped_fs.tahoeutil.list(self.dircap, _path): if dirs_only and item['type'] == 'filenode': continue elif files_only and item['type'] == 'dirnode': continue if wildcard is not None and \ not fnmatch.fnmatch(item['name'], wildcard): continue if full: item_path = relpath(pathjoin(_path, item['name'])) elif absolute: item_path = abspath(pathjoin(_path, item['name'])) else: item_path = item['name'] cache_name = self.wrapped_fs._fixpath(u"%s/%s" % \ (path, item['name'])) self._cache_set(cache_name, 'getinfo', (), {}, (True, item)) result.append((item_path, item)) return result