Skip to content

Commit

Permalink
Remove single tag fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
dizel-by committed Sep 3, 2012
1 parent 67e610a commit 73a023f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ You can see what's going on by checking the test/ directory insides (I'll use gi
D test/tags/tag3/file1
D test/tags/tag4/file1
</pre>
As you can see the link to file1 was deleted from relevant tag directories. Note, there is currently no way to remove a file from just one tag, it's all or nothing.

Ok then, now I'm going to add a tag and then tag an existing file.
<pre>
Expand Down
11 changes: 6 additions & 5 deletions tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,12 @@ def getattr(self, path):
def unlink(self, path):
(p, n) = os.path.split(path)
fileid = self.__filename_id[n]
for tagid in frozenset(self.__file_tags[fileid]):
tag = self.__id_tag[tagid]
os.unlink(os.path.join(self.__basepath, "tags", tag, n))
self.__tag_files[tagid].remove(fileid)
self.__file_tags[fileid].remove(tagid)
for tag in p.split('/'):
if len(tag):
tagid = self.__tag_id[tag]
os.unlink(os.path.join(self.__basepath, "tags", tag, n))
self.__tag_files[tagid].remove(fileid)
self.__file_tags[fileid].remove(tagid)

return 0

Expand Down

0 comments on commit 73a023f

Please sign in to comment.