GTG

Merge lp:~bryce/gtg/lp-602108 into lp:~gtg/gtg/old-trunk

Proposed by Bryce Harrington
Status: Merged
Merged at revision: 959
Proposed branch: lp:~bryce/gtg/lp-602108
Merge into: lp:~gtg/gtg/old-trunk
Diff against target: 55 lines (+12/-6)
2 files modified
GTG/core/filteredtree.py (+8/-5)
gtcli (+4/-1)
To merge this branch: bzr merge lp:~bryce/gtg/lp-602108
Reviewer Review Type Date Requested Status
Lionel Dricot code Pending
Review via email: mp+29248@code.launchpad.net

Description of the change

I've attached a branch with a change to the filter code that seems to fix it (at least for the test case in the description).

It seems that in __is_displayed(), if there is a tag filter using a tag that is not defined, it skips processing of it (which is correct) but the logic falls through to returning a True result by default. This branch changes this particular error case to default as False.

I am not 100% certain that this is the proper way to fix the bug, thus am proposing a merge for lionel to review rather than push it right into the tree. Meanwhile, I'll run this branch on my local tree and look for issues.

To post a comment you must log in.
Revision history for this message
Bryce Harrington (bryce) wrote :

I also fixed some of the surrounding comments grammar and spelling, sorry for that noise.

Revision history for this message
Luca Invernizzi (invernizzi) wrote :

This one probably needs to be ported to liblarch.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'GTG/core/filteredtree.py'
2--- GTG/core/filteredtree.py 2010-06-22 07:30:45 +0000
3+++ GTG/core/filteredtree.py 2010-07-06 03:22:22 +0000
4@@ -496,7 +496,7 @@
5
6 def is_displayed(self,tid):
7 """
8- This is a public method that return True if the task is
9+ This is a public method that returns True if the task is
10 currently displayed in the tree
11 """
12 if tid:
13@@ -507,7 +507,7 @@
14
15 def __is_displayed(self, tid):
16 """
17- This is a private method that return True if the task *should*
18+ This is a private method that returns True if the task *should*
19 be displayed in the tree, regardless of its current status
20 """
21 if tid:
22@@ -522,11 +522,14 @@
23 result = result and temp
24 if not filt.get_parameters('ignore_when_counting'):
25 counting_result = counting_result and temp
26+ else:
27+ # Filter undefined (maybe it's a non-existant tag?)
28+ result = False
29 if counting_result and tid not in self.counted_nodes:
30- #This is an hard custom optimisation for task counting
31+ #This is a hard custom optimisation for task counting.
32 #Normally, we would here reset the cache of counted tasks
33- #But this slow down a lot the startup.
34- #So, we update manually the cache.
35+ #But this slows down the startup a lot.
36+ #So, we update the cache manually.
37 for k in self.count_cache.keys():
38 f = self.req.get_filter(k)
39 if f.is_displayed(tid):
40
41=== modified file 'gtcli'
42--- gtcli 2010-07-03 05:46:35 +0000
43+++ gtcli 2010-07-06 03:22:22 +0000
44@@ -126,7 +126,10 @@
45
46 for task in tasks:
47 task['startdate'] = startdate
48- print task['id']
49+ tags = []
50+ for tag in list(task['tags']):
51+ tags.append(str(tag))
52+ print "%-12s %-20s %s" %(task['id'], ", ".join(tags), task['title'])
53 timi.modify_task(task['id'], task)
54
55 def open_task_editor(tid):

Subscribers

People subscribed via source and target branches

to status/vote changes: