#3227: Error in reports due to bad datetime formatting
----------------------------+-----------------------------------------------
Reporter: [EMAIL PROTECTED] | Owner: jonas
Type: defect | Status: new
Priority: high | Milestone:
Component: general | Version: 0.9.5
Severity: major | Keywords:
----------------------------+-----------------------------------------------
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.
--
Ticket URL: <http://projects.edgewall.com/trac/ticket/3227>
The Trac Project <http://trac.edgewall.com/>
_______________________________________________
Trac-Tickets mailing list
[email protected]
http://lists.edgewall.com/mailman/listinfo/trac-tickets