#9271 closed defect (fixed)
[PATCH] Blank date in timeline filter causes error.
Reported by: | 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)
Change History (15)
comment:1 by , 15 years ago
Milestone: | → next-minor-0.12.x |
---|
by , 15 years ago
Attachment: | t9271_timeline-blank-date_r9677.patch added |
---|
#9271 - Timeline: assume todays date when from date is blank
comment:2 by , 15 years ago
Milestone: | next-minor-0.12.x → 0.12 |
---|---|
Owner: | set to |
Priority: | normal → highest |
Summary: | Blank date in timeline filter causes error. → [PATCH] Blank date in timeline filter causes error. |
The patch t9271_timeline-blank-date_r9677.patch applies to r9677 and 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…
comment:3 by , 15 years ago
Status: | new → assigned |
---|
comment:5 by , 15 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.
follow-up: 8 comment:6 by , 15 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 , 15 years ago
Attachment: | t9271_timeline-blank-date_r9677.2.patch added |
---|
#9271 - Timeline: assume todays date when from date is blank (replaces prev. patch)
comment:7 by , 15 years ago
This 2nd patch replaces the 1st and is influenced by remarks in comment:5 by rblank (thanks!).
follow-up: 9 comment:8 by , 15 years ago
Replying to mrelbe:
Since the statement is encapsulated by line 97 (
if 'from' in req.args:
) we are guaranteed thatreqfromdate
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.
comment:9 by , 15 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 , 15 years ago
Attachment: | t9271_timeline-blank-date_r9677.3.patch added |
---|
#9271 - Timeline: assume todays date when from date is blank (replaces prev. patch)
comment:10 by , 15 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 , 15 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
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 ;-)