Edgewall Software
Modify

Opened 14 years ago

Closed 14 years ago

Last modified 14 years ago

#9271 closed defect (fixed)

[PATCH] Blank date in timeline filter causes error.

Reported by: ibest@… Owned by: Mikael Relbe
Priority: highest Milestone: 0.12
Component: timeline Version: 0.12dev
Severity: normal Keywords: timeline, filter, empty
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

Description

When I open Timeline page, clear the "View changes from" field and press update, I have an error:

Error: Invalid Date
"" is an invalid date, or the date format is not known. Try "MM/DD/YY" instead.

Perhaps blank date should point to today's date

Attachments (3)

t9271_timeline-blank-date_r9677.patch (1.0 KB ) - added by Mikael Relbe 14 years ago.
#9271 - Timeline: assume todays date when from date is blank
t9271_timeline-blank-date_r9677.2.patch (838 bytes ) - added by Mikael Relbe 14 years ago.
#9271 - Timeline: assume todays date when from date is blank (replaces prev. patch)
t9271_timeline-blank-date_r9677.3.patch (776 bytes ) - added by Mikael Relbe 14 years ago.
#9271 - Timeline: assume todays date when from date is blank (replaces prev. patch)

Download all attachments as: .zip

Change History (15)

comment:1 by Christian Boos, 14 years ago

Milestone: next-minor-0.12.x

This is not a regression from 0.11, so it can wait.

As usual, providing a patch is a great way to get the issue re-assigned to a closer milestone ;-)

by Mikael Relbe, 14 years ago

#9271 - Timeline: assume todays date when from date is blank

comment:2 by Mikael Relbe, 14 years ago

Milestone: next-minor-0.12.x0.12
Owner: set to Mikael Relbe
Priority: normalhighest
Summary: Blank date in timeline filter causes error.[PATCH] Blank date in timeline filter causes error.

The patch t9271_timeline-blank-date_r9677.patch fixes the problem and assumes todays date when user enters a blank from-date in the timeline view.

I re-targeted this ticket to 0.12 since this is a defect…

Version 0, edited 14 years ago by Mikael Relbe (next)

comment:3 by Mikael Relbe, 14 years ago

Status: newassigned

comment:4 by Christian Boos, 14 years ago

Looks good! I'll test and apply this evening.

comment:5 by Remy Blank, 14 years ago

I'd use the following to get the 'from' argument, as it's assumed to be a string in the next line:

reqfromdate = req.args.get('from', '')

And maybe even avoid converting today to string and re-parsing it afterward.

comment:6 by Mikael Relbe, 14 years ago

Since the statement is encapsulated by line 97 (if 'from' in req.args:) we are guaranteed that reqfromdate will be present, and a string.

97:  if 'from' in req.args:
         ....
99:      reqfromdate = req.args.get('from')
         ....

But you are nonetheless correct; your suggested change is perhaps more robust.

by Mikael Relbe, 14 years ago

#9271 - Timeline: assume todays date when from date is blank (replaces prev. patch)

comment:7 by Mikael Relbe, 14 years ago

This 2nd patch replaces the 1st and is influenced by remarks in comment:5 by rblank (thanks!).

in reply to:  6 ; comment:8 by Remy Blank, 14 years ago

Replying to mrelbe:

Since the statement is encapsulated by line 97 (if 'from' in req.args:) we are guaranteed that reqfromdate will be present, and a string.

Oh, right. So in that case, I'd write req.args['from']. Using req.args.get() gives a hint that you don't know if the key is in the dict or not.

But hey, those are really details (almost purely coding style), so don't loose too much time on that.

in reply to:  8 comment:9 by Mikael Relbe, 14 years ago

Replying to rblank:

But hey, those are really details (almost purely coding style), so don't loose too much time on that.

But that's really important. I got it wrong then, anyway. I'm pretty sure Christian will quickly fix that if he approves the patch in general. Thanks for the feedback (which I am grateful for since I'm in a learning mode when it comes to Python/Trac).

by Mikael Relbe, 14 years ago

#9271 - Timeline: assume todays date when from date is blank (replaces prev. patch)

comment:10 by Mikael Relbe, 14 years ago

The patch t9271_timeline-blank-date_r9677.3.patch is the final one, it cannot be made simpler than this. (Comment: fromdate is initialised with todays date— line 95 —thus no need to set that again as in prev. patches…)

Thanks for showing me patience (three trials for four lines of code *sic*) and thanks to Remy for your remarks.

comment:11 by Remy Blank, 14 years ago

Resolution: fixed
Status: assignedclosed

That one is absolutely perfect. Applied in [9681]. Thanks!

(And about [9680], the message should actually reference #9318.)

comment:12 by Mikael Relbe, 14 years ago

Updated TracTimeline@20.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Mikael Relbe.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Mikael Relbe to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.