Modify ↓
#3227 closed defect (fixed)
Error in reports due to bad datetime formatting
Reported by: | Owned by: | Matthew Good | |
---|---|---|---|
Priority: | high | Milestone: | 0.10 |
Component: | general | Version: | 0.9.5 |
Severity: | major | Keywords: | |
Cc: | Branch: | ||
Release Notes: | |||
API Changes: | |||
Internal Changes: |
Description
I'm having trouble with the predefined reports #6 and #9:
Traceback (most recent call last): File "/usr/lib/python2.3/site-packages/trac/web/modpython_frontend.py", line 206, in handler dispatch_request(mpr.path_info, mpr, env) File "/usr/lib/python2.3/site-packages/trac/web/main.py", line 139, in dispatch_request dispatcher.dispatch(req) File "/usr/lib/python2.3/site-packages/trac/web/main.py", line 107, in dispatch resp = chosen_handler.process_request(req) File "/usr/lib/python2.3/site-packages/trac/ticket/report.py", line 113, in process_request resp = self._render_view(req, db, id) File "/usr/lib/python2.3/site-packages/trac/ticket/report.py", line 354, in _render_view value['date'] = util.format_date(cell) File "/usr/lib/python2.3/site-packages/trac/util.py", line 412, in format_date return format_datetime(t, format, gmt) File "/usr/lib/python2.3/site-packages/trac/util.py", line 406, in format_datetime t = time.localtime(int(t)) ValueError: invalid literal for int(): None
The problem is that the format_datetime() and http_date() get strings like "None" as input instead of None objects. And the reason for this seems to be that 0.9.5 has a line
str = str(cell)
respectively trunk has
cell = unicode(cell)
in the report.py file. My temporary workaround was to hack the date formatting functions so that they handle the string "None" like None, but the real fix would probably be something like:
if cell is not None: cell = unicode(cell)
in the report module.
Attachments (0)
Change History (2)
comment:1 by , 18 years ago
Milestone: | → 0.10 |
---|---|
Owner: | changed from | to
Status: | new → assigned |
comment:2 by , 18 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Ok, a fix has been committed in r3745.
Note:
See TracTickets
for help on using tickets.
Well, passing
None
to the date formatting methods will use the current date/time, which is probably not what you'd want to display when the value is null. However, it should be possible to provide another simple workaround.