← Back to team overview

gtg-contributors team mailing list archive

Re: Bug 694360: Missing a tag when inheriting

 

Hi,

Thank you Lionel for your response. If I understood it right,
tag_added() just add metadata about adding a tag to the task. The method
add_tag() is more sophisticated and solves the problems you have
described (no text, placing in the right place).

I went through a code and replaced places where should be add_tag()
instead of tag_added(). After applying the attached patch, GTG behaves
better to my expectation about work with tags. I hope, it could be
merged in the trunk.

-- 
Izidor Matušov
http://www.i.matusov.sk


Am Donnerstag, den 06.01.2011, 13:17 +0100 schrieb Lionel Dricot:
> Hi,
> 
> I think this behavior was introduced for the case where a task don't
> currently have any text (and thus, we cannot add the tag to that text).
> 
> Another problem was to add the @tag in the start of the text, which is
> done in the TaskEditor. It is thus a sort of indirect call to the task
> Editor.
> 
> Lionel
diff -ur a/GTG/core/requester.py b/GTG/core/requester.py
--- a/GTG/core/requester.py	2011-01-15 10:53:04.950401999 +0100
+++ b/GTG/core/requester.py	2011-01-15 10:55:20.580402001 +0100
@@ -88,7 +88,7 @@
         task = self.ds.new_task(pid=pid, newtask=newtask)
         if tags:
             for t in tags:
-                task.tag_added(t.get_name())
+                task.add_tag(t.get_name())
         return task
 
     def delete_task(self, tid):
diff -ur a/GTG/core/task.py b/GTG/core/task.py
--- a/GTG/core/task.py	2011-01-15 10:53:04.960402001 +0100
+++ b/GTG/core/task.py	2011-01-15 10:54:51.470402001 +0100
@@ -340,7 +340,7 @@
             if task.can_be_deleted:
                 task.set_start_date(self.get_start_date())
                 for t in self.get_tags():
-                    task.tag_added(t.get_name())
+                    task.add_tag(t.get_name())
 
     def remove_subtask(self, tid):
         """Removed a subtask from the task.
@@ -535,7 +535,7 @@
         enew = saxutils.escape(saxutils.unescape(new))
         self.content = self.content.replace(eold, enew)
         self.remove_tag(old)
-        self.tag_added(new)
+        self.add_tag(new)
 
     def tag_added(self, tagname):
         "Add a tag. Does not add '@tag' to the contents. See insert_tag"

References