GTG

Merge lp:~parinporecha/gtg/config_parser_bug into lp:~gtg/gtg/old-trunk

Proposed by Parin Porecha
Status: Merged
Merge reported by: Nimit Shah
Merged at revision: not available
Proposed branch: lp:~parinporecha/gtg/config_parser_bug
Merge into: lp:~gtg/gtg/old-trunk
Diff against target: 30 lines (+4/-3)
2 files modified
GTG/core/__init__.py (+4/-2)
GTG/gtk/browser/browser.py (+0/-1)
To merge this branch: bzr merge lp:~parinporecha/gtg/config_parser_bug
Reviewer Review Type Date Requested Status
Nimit Shah Pending
Review via email: mp+183771@code.launchpad.net

Description of the change

Patch for Bug #1218093 and Bug #1218708.

If you ran GTG while facing the bugs, it might've messed up your config files '~/.config/gtg/gtg.conf', '~/.config/gtg/tasks.conf'

This patch will give errors if those malformed strings are present in them. Please delete your 'tasks.conf' and remove the list of expanded tags in 'gtg.conf', or delete the file itself.

After removing those config files, no errors should be displayed and the state of expanded and collapsed tags in sidebar, and tasks should be remembered upon restarting GTG.

To post a comment you must log in.
Revision history for this message
Nimit Shah (nimit-svnit) wrote :

Thanks Parin for the patch :)

1309. By Parin Porecha

Updated patch to parse strings from config file 'tasks.conf' taking care of all spaces, tabs etc.

Revision history for this message
Parin Porecha (parinporecha) wrote :

Hi Nimit,

There was a change still left to do in the branch, I've updated it.
Sorry, I should've changed the status from 'Needs Review' to 'Work in Progress' to avoid this type of situation.

Please review it :)

Revision history for this message
Izidor MatuĊĦov (izidor) wrote :

Please decompose this line:

return ''.join(value.split()).split(',')

Make it more readable. For example:

value_with_no_whitespace = ''.join(value.split())
return value_with_no_whitespace.split(',')

It is more easy to read. (If you come up with a shorter name, it will een more readable :)

1310. By Parin Porecha

Added a variable to parser to improve readability

Revision history for this message
Parin Porecha (parinporecha) wrote :

I've decomposed it :)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'GTG/core/__init__.py'
2--- GTG/core/__init__.py 2013-09-04 11:55:08 +0000
3+++ GTG/core/__init__.py 2013-09-05 09:19:58 +0000
4@@ -174,10 +174,12 @@
5 # Check single quote for backward compatibility
6 if value[0] == '(' and value[-1] == ')':
7 value = value[1:-1]
8- return value.split(', ')
9+ # Remove all whitespaces, tabs, newlines and then split by ','
10+ value_without_spaces = ''.join(value.split())
11+ return value_without_spaces.split(',')
12
13 def set(self, tid, option, value):
14- value = ', '.join(str(x) for x in value)
15+ value = ','.join(str(x) for x in value)
16 self._conf.set(tid, option, value)
17 self.save()
18
19
20=== modified file 'GTG/gtk/browser/browser.py'
21--- GTG/gtk/browser/browser.py 2013-09-04 11:55:08 +0000
22+++ GTG/gtk/browser/browser.py 2013-09-05 09:19:58 +0000
23@@ -24,7 +24,6 @@
24 import time
25 import threading
26 from webbrowser import open as openurl
27-from re import search, escape, findall
28
29 import pygtk
30 pygtk.require('2.0')

Subscribers

People subscribed via source and target branches

to status/vote changes: