GTG

Merge lp:~izidor/gtg/bug1018805 into lp:~gtg/gtg/old-trunk

Proposed by Izidor Matušov
Status: Merged
Merged at revision: 1199
Proposed branch: lp:~izidor/gtg/bug1018805
Merge into: lp:~gtg/gtg/old-trunk
Diff against target: 32 lines (+14/-4)
1 file modified
GTG/gtk/editor/editor.py (+14/-4)
To merge this branch: bzr merge lp:~izidor/gtg/bug1018805
Reviewer Review Type Date Requested Status
Lionel Dricot (community) Approve
Bertrand Rousseau (community) code Approve
Review via email: mp+112898@code.launchpad.net

Description of the change

Fix for bug #1018805: Crash when entering invalid date

My solution solves the bug. There is also side effect (which was already there before the fix):
 1, Create invalid dates in both fields, e.g "fjasdlfjalsd", "fjasdljfalsd"
 2, Select calendar in start date and choose a date
 3, Start date is updated *and* due date is cleared instead of preserving the invalid date.

Is it acceptable behavior for GTG?

To post a comment you must log in.
Revision history for this message
Bertrand Rousseau (bertrand-rousseau) wrote :

It's ok for me, no need to nitpick for trashing an invalid date.

review: Approve (code)
Revision history for this message
Lionel Dricot (ploum-deactivatedaccount) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'GTG/gtk/editor/editor.py'
2--- GTG/gtk/editor/editor.py 2012-05-20 18:14:23 +0000
3+++ GTG/gtk/editor/editor.py 2012-06-30 11:58:19 +0000
4@@ -265,14 +265,24 @@
5
6 #refreshing the start date field
7 startdate = self.task.get_start_date()
8- prevdate = Date.parse(self.startdate_widget.get_text())
9- if startdate != prevdate:
10+ try:
11+ prevdate = Date.parse(self.startdate_widget.get_text())
12+ update_date = startdate != prevdate
13+ except ValueError:
14+ update_date = True
15+
16+ if update_date:
17 self.startdate_widget.set_text(str(startdate))
18
19 #refreshing the due date field
20 duedate = self.task.get_due_date()
21- prevdate = Date.parse(self.duedate_widget.get_text())
22- if duedate != prevdate:
23+ try:
24+ prevdate = Date.parse(self.duedate_widget.get_text())
25+ update_date = duedate != prevdate
26+ except ValueError:
27+ update_date = True
28+
29+ if update_date:
30 self.duedate_widget.set_text(str(duedate))
31
32 # refreshing the closed date field

Subscribers

People subscribed via source and target branches

to status/vote changes: