Why do format_date() and format_time() return the current time if their input
is empty? This is the wrong thing for them to do in a number of places: the
milestone duedates, the version release times, and I don't know where else.
Where is that the /correct/ behavior?
Eli
Ah, so *that* is why, when I nuke 'due date' from my milestones it keeps
getting filled in with now()?
--
Jeroen Ruigrok van der Werven <asmodai(-at-)in-nomine.org> / asmodai
イェルーン ラウフロック ヴァン デル ウェルヴェン
http://www.in-nomine.org/ | http://www.rangaku.org/
Everything comes to those who wait...
I found 3 locations where that seems to be the intent:
./trac/admin/templates/admin_versions.html:
value="${format_datetime()}" /><br />
./trac/versioncontrol/templates/revisionlog.txt:# ${format_datetime()}
./trac/web/main.py: 'time': format_datetime(),
and 58 where we're passing something in.
Eli
Yep.
I find it annoying, personally...
Eli
It is. And it makes no sense from a usability point of view, at least from my
perspective.
So chalk up a +1 if you want to fix it. ;)
--
Jeroen Ruigrok van der Werven <asmodai(-at-)in-nomine.org> / asmodai
イェルーン ラウフロック ヴァン デル ウェルヴェン
http://www.in-nomine.org/ | http://www.rangaku.org/
Dream, a noise, the wind awakes me, and you're already here...
This behavior is basically inherited from the time.strftime() function in the Python standard library: if no time is provided, assume now(). I do think this behavior is okay. When a code path expects a datetime to be None, it probably should check before calling format_xxx().
And what's the alternative, really? Returning an empty string if not datetime is given sounds like a bad idea to me. The only other option would be to make the datetime a required argument.
Cheers,
Chris
--
http://www.cmlenz.net/
--
Christopher Lenz
cmlenz at gmx.de
http://www.cmlenz.net/