Modify

Opened 9 years ago

Closed 9 years ago

#2149 closed enhancement (fixed)

Use predefined date format for macro arguments

Reported by: nic@… Owned by: Markus Pelkonen
Priority: normal Component: TimeVisualizerPlugin
Severity: normal Keywords:
Cc: th07@… Trac Release: 0.10

Description

I have a european date format set and so get the following error:

Traceback (most recent call last):

File "/usr/lib/python2.3/site-packages/trac/web/main.py", line 406, in dispatch_request

dispatcher.dispatch(req)

File "/usr/lib/python2.3/site-packages/trac/web/main.py", line 237, in dispatch

resp = chosen_handler.process_request(req)

File "build/bdist.linux-x86_64/egg/tractimevisualizerplugin/pluginwrapper.py", line 31, in process_request File "build/bdist.linux-x86_64/egg/tractimevisualizerplugin/impl.py", line 326, in process_request File "build/bdist.linux-x86_64/egg/tractimevisualizerplugin/impl.py", line 56, in build_svg

Exception: invalid startdate: '08/8/07', expected format: 'YYYY-MM-DD'

Attachments (0)

Change History (5)

comment:1 Changed 9 years ago by Markus Pelkonen

Cc: th07@… added; anonymous removed

Thanks for this report, I'm gonna check this when I have spare time...

comment:2 Changed 9 years ago by Markus Pelkonen

I'm not avare about the use case where you encounter to this issue. I expect that you tried the macro somehow as follows:

[[BurnDown(query=targetmilestone=mile1&datestart=08/8/07&dateend=8/15/07)]]

Implementation uses Trac code base to parse the passed time timevisualizerplugin/0.10/tractimevisualizerplugin/impl.py@2607#L54.

You should recover from this issue by using macro as follows:

[[BurnDown(query=targetmilestone=mile1&datestart=2007-08-08&dateend=2007-08-15)]]

As a side node, I don't know, where from Trac identifies, which format to use. I expect that user agent gives the hint. If so, then this comes to real i18n issue, thus others use ur ISO format, others have their own locale settings. The solution would be to force macro to certain format (my choice would be ur ISO format).

Meanwhile, please let me know if my proposal above did help.

comment:3 Changed 9 years ago by Markus Pelkonen

Status: newassigned
Summary: European date format breaks implementationUse predefined date format for macro arguments
Type: defectenhancement

It really makes sense to use pre-defined format rather than user specific, which just doesn't work in global world. I think that best way is to let user to specify format in Trac config. It would makes sense to let user to override format with macro parameter.

As a noob Python developer, I need to find implementation similar to Javas SimpleDateFormat. Any ideas / PoC patches are welcome.

Changed

comment:4 Changed 9 years ago by Markus Pelkonen

I've now studied the topic and have PoC implementation (on my laptop) using ISO 8601 format. However, one has to write times in UTC-which might be quite difficult for many. Using other time zone would be possible, but then full form would be needed, e.g. "2007-12-23T00:00:00+02:00"... I might consider implementing spec with exception, like this "2007-12-12Z+2". Then having one year burndown at my time zone, i would have times "2007Z+2" - "2008Z+2"

I still need to consider keeping plugin backward compatible, which requires some extra effort before I'll commit changes...

comment:5 Changed 9 years ago by Markus Pelkonen

Resolution: fixed
Status: assignedclosed

0.6 version ([3276]) implements ISO 8601 format.

Modify Ticket

Action
as closed The owner will remain Markus Pelkonen.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.