コード例 #1
0
 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)
コード例 #2
0
 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
コード例 #3
0
 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)
コード例 #4
0
 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)
コード例 #5
0
 def expand_dir(self, value):
     """update doc when dir expanded"""
     AbstractSharingData.expand_dir(self, value)
     self._get_sharing_container(value).expand_dir(value)
コード例 #6
0
 def add(self, value):
     """sets new value for repository"""
     AbstractSharingData.add(self, value)
     self._get_sharing_container(value).add(value)
コード例 #7
0
 def del_file(self, value):
     """create new DirContainer"""
     AbstractSharingData.del_file(self, value)
     del self.files[value]
コード例 #8
0
 def __init__(self):
     # {root: DirContainers}
     self.files = {}
     AbstractSharingData.__init__(self)
コード例 #9
0
 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)
コード例 #10
0
 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)
コード例 #11
0
 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)
コード例 #12
0
 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)
コード例 #13
0
 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)
コード例 #14
0
 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)
コード例 #15
0
 def add(self, path):
     """sets new value for files"""
     AbstractSharingData.add(self, path)
     self._set_file(path)
コード例 #16
0
 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)
コード例 #17
0
 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)
コード例 #18
0
 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)
コード例 #19
0
 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)
コード例 #20
0
 def __init__(self):
     self.config.add_section(SECTION_FILE)
     AbstractSharingData.__init__(self)