← Back to team overview

gtg team mailing list archive

[Merge] lp:~kleinric/gtg/hamster_fixes into lp:gtg

 

Richard Klein has proposed merging lp:~kleinric/gtg/hamster_fixes into lp:gtg.

Requested reviews:
  Gtg developers (gtg)
Related bugs:
  Bug #897703 in Getting Things GNOME!: "hamster applet receives incorrect tags"
  https://bugs.launchpad.net/gtg/+bug/897703
  Bug #897705 in Getting Things GNOME!: "Hamster Applet puts all tags together into one tag with #before each entry"
  https://bugs.launchpad.net/gtg/+bug/897705

For more details, see:
https://code.launchpad.net/~kleinric/gtg/hamster_fixes/+merge/83804

Fixes 2 bugs in the Hamster Applet. 

"@test1, @test2" GTG Tags are translated into a single "#test1 #test2" in Hamster. I've replaced the "#" with "," so that hamster now correctly interprets the tags.

If hamster is set to receive the Category Name from the GTG Tags, GTG crashes if there are no tags. I added code to check that "len(gtg_tags) != 0" if there are no tags, then the category is set to "unsorted"


-- 
https://code.launchpad.net/~kleinric/gtg/hamster_fixes/+merge/83804
Your team Gtg developers is requested to review the proposed merge of lp:~kleinric/gtg/hamster_fixes into lp:gtg.
=== modified file 'GTG/plugins/hamster/hamster.py'
--- GTG/plugins/hamster/hamster.py	2011-11-19 21:41:08 +0000
+++ GTG/plugins/hamster/hamster.py	2011-11-29 16:15:32 +0000
@@ -73,8 +73,14 @@
             if len(intersection) > 0:
                 category = "%s" % categories[intersection.pop()]
             else:
-                # Force category if not found
-                category = gtg_tags[0]
+		# Check that there is at least one tag to set as the category
+		if len(gtg_tags) == 0:
+                   category = "unsorted"
+	        else:
+		    # Force category if not found
+                    category = gtg_tags[0]
+
+
 
         description = ""
         if self.preferences['description'] == 'title':
@@ -92,7 +98,7 @@
         except dbus.exceptions.DBusException:
             # old hamster version, doesn't support tags
             pass
-        tag_str = "".join([" #" + x for x in tag_candidates])
+        tag_str = "".join([" ," + x for x in tag_candidates])
             
         #print '%s%s,%s%s'%(activity, category, description, tag_str)
         hamster_id=self.hamster.AddFact(activity, tag_str, 0, 0, category, description)