GTG

Merge lp:~evtuhovich/gtg/hamster into lp:~gtg/gtg/old-trunk

Proposed by Ivan Evtukhovich
Status: Merged
Merged at revision: 932
Proposed branch: lp:~evtuhovich/gtg/hamster
Merge into: lp:~gtg/gtg/old-trunk
Diff against target: 53 lines (+11/-6)
1 file modified
GTG/plugins/hamster/hamster.py (+11/-6)
To merge this branch: bzr merge lp:~evtuhovich/gtg/hamster
Reviewer Review Type Date Requested Status
Luca Invernizzi (community) Approve
Review via email: mp+46424@code.launchpad.net

Description of the change

Fix #620313

To post a comment you must log in.
Revision history for this message
Luca Invernizzi (invernizzi) wrote :

Thanks a lot for the fix! Sorry for the delay.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'GTG/plugins/hamster/hamster.py'
2--- GTG/plugins/hamster/hamster.py 2010-09-14 14:57:54 +0000
3+++ GTG/plugins/hamster/hamster.py 2011-01-16 21:16:54 +0000
4@@ -18,6 +18,7 @@
5 # -----------------------------------------------------------------------------
6 import gtk
7 import dbus
8+import re
9 import time
10 import os
11 from calendar import timegm
12@@ -54,23 +55,27 @@
13 elif self.preferences['activity'] == 'title':
14 activity = gtg_title
15 # hamster can't handle ',' or '@' in activity name
16- activity = activity.replace(',', '').replace('@', '')
17+ activity = activity.replace(',', '')
18+ activity = re.sub('\ +@.*', '', activity)
19
20 category = ""
21 if self.preferences['category'] == 'auto_tag':
22 hamster_activities=dict([(unicode(x[0]), unicode(x[1])) for x in self.hamster.GetActivities()])
23 if (gtg_title in hamster_activities
24 or gtg_title.replace(",", "") in hamster_activities):
25- category = "@%s" % hamster_activities[gtg_title]
26+ category = "%s" % hamster_activities[gtg_title]
27
28 if (self.preferences['category'] == 'tag' or
29 (self.preferences['category'] == 'auto_tag' and not category)):
30 # See if any of the tags match existing categories
31- categories = dict([(unicode(x).lower(), unicode(x)) for x in self.hamster.GetCategories()])
32+ categories = dict([(unicode(x[1]).lower(), unicode(x[1])) for x in self.hamster.GetCategories()])
33 intersection = set(categories.keys()).intersection(set([x.lower() for x in gtg_tags]))
34 if len(intersection) > 0:
35- category = "@%s" % categories[intersection.pop()]
36-
37+ category = "%s" % categories[intersection.pop()]
38+ else:
39+ # Force category if not found
40+ category = gtg_tags[0]
41+
42 description = ""
43 if self.preferences['description'] == 'title':
44 description = gtg_title
45@@ -90,7 +95,7 @@
46 tag_str = "".join([" #" + x for x in tag_candidates])
47
48 #print '%s%s,%s%s'%(activity, category, description, tag_str)
49- hamster_id=self.hamster.AddFact('%s%s,%s%s'%(activity, category, description, tag_str), 0, 0)
50+ hamster_id=self.hamster.AddFact(activity, tag_str, 0, 0, category, description)
51
52 ids=self.get_hamster_ids(task)
53 ids.append(str(hamster_id))

Subscribers

People subscribed via source and target branches

to status/vote changes: