def del_file(self, value): """create new DirContainer""" AbstractSharingData.del_file(self, value) # delete entry values = [repo for repo in self.get_repositories() if repo != value] # update list of repositories self._set_repositories(values)
def remove(self, value): """remove custom value""" AbstractSharingData.remove(self, value) container = self._get_sharing_container(value) if container: del container[value] else: print "%s already removed"% value
def add_file(self, value): """create new DirContainer""" AbstractSharingData.add_file(self, value) for repo in self.files: if value.startswith(repo): raise ValueError("'%s' part of existing repo %s" % (value, repo)) if repo.startswith(value): raise ValueError("'%s' conflicts with existing repo %s" % (value, repo)) # else: continue self.files[value] = DirContainer(value)
def add_file(self, value): """create new DirContainer""" AbstractSharingData.add_file(self, value) existing_repos = self.get_repositories() # update list of repositories for existing_repo in existing_repos: if value.startswith(existing_repo): raise ValueError("'%s' part of existing repo %s"\ %(value, existing_repo)) if existing_repo.startswith(value): raise ValueError("'%s' conflicts with existing repo %s"\ %(value, existing_repo)) # else: continue existing_repos.append(value) self._set_repositories(existing_repos)
def expand_dir(self, value): """update doc when dir expanded""" AbstractSharingData.expand_dir(self, value) self._get_sharing_container(value).expand_dir(value)
def add(self, value): """sets new value for repository""" AbstractSharingData.add(self, value) self._get_sharing_container(value).add(value)
def del_file(self, value): """create new DirContainer""" AbstractSharingData.del_file(self, value) del self.files[value]
def __init__(self): # {root: DirContainers} self.files = {} AbstractSharingData.__init__(self)
def tag_files(self, triplet): """sets new value for tagged file""" AbstractSharingData.tag_files(self, triplet) path, names, tag = triplet files = [os.path.join(path, name) for name in names] self._get_sharing_container(path).tag_container(files, tag)
def tag_files(self, triplet): """sets new value for tagged file""" AbstractSharingData.tag_files(self, triplet) dir_path, names, tag = triplet for name in names: self._set_file(os.path.join(dir_path, name), tag=tag)
def share_file(self, pair): """forward command to cache""" AbstractSharingData.share_file(self, pair) full_path, share = pair self._set_file(full_path, share=share)
def share_files(self, triplet): """forward command to cache""" AbstractSharingData.share_files(self, triplet) dir_path, names, share = triplet for name in names: self._set_file(os.path.join(dir_path, name), share=share)
def expand_dir(self, path): """put into cache new information when dir expanded in tree""" AbstractSharingData.expand_dir(self, path) for file_name in os.listdir(path): file_path = os.path.join(path, file_name) self._set_file(file_path)
def remove(self, value): """remove custom value""" AbstractSharingData.remove(self, value) if self.config.has_option(SECTION_CUSTOM, value): self.config.remove_option(SECTION_CUSTOM, value)
def add(self, path): """sets new value for files""" AbstractSharingData.add(self, path) self._set_file(path)
def share_files(self, triplet): """forward command to cache""" AbstractSharingData.share_files(self, triplet) path, names, share = triplet files = [os.path.join(path, name) for name in names] self._get_sharing_container(path).share_container(files, share)
def share_file(self, pair): """forward command to cache""" AbstractSharingData.share_file(self, pair) path, share = pair self._get_sharing_container(path).share_container(path, share)
def tag_file(self, pair): """sets new value for tagged file""" AbstractSharingData.tag_file(self, pair) path, tag = pair self._set_file(path, tag=tag)
def tag_file(self, pair): """sets new value for tagged file""" AbstractSharingData.tag_file(self, pair) path, tag = pair self._get_sharing_container(path).tag_container(path, tag)
def __init__(self): self.config.add_section(SECTION_FILE) AbstractSharingData.__init__(self)