Roundup Tracker - Issues

Issue 2550802

classification
roundup.date.Date()s formatted using serialise may get a seconds part of 60.000
Type: behavior Severity: normal
Components: Versions: 1.4
process
Status: closed fixed
:
: : ber, nop-abc-se
Priority: : patch

Created on 2013-03-21 08:46 by nop-abc-se, last changed 2013-03-22 11:10 by ber.

Files
File name Uploaded Description Edit Remove
roundup-issue2550802.patch nop-abc-se, 2013-03-22 10:33
Messages
msg4825 Author: [hidden] (nop-abc-se) Date: 2013-03-21 08:46
Long description, and resolution:

I'm running a 1.4.21 tracker on sqlite-backend and web frontend behind apache.

After importing a bunch of issues of my custom class, one item view failed with the following 
templating error:
"""
<type 'exceptions.ValueError'>: second must be in 0..59
Debugging information follows
While evaluating the standard:'context/history' expression on line 61
"""

When dumping history on the command line I found one journal entry for the item with the 
Date 2013-03-19.13:07:60.000.
Note the bad seconds value.

Now date.py has a check on the seconds value on line 277 as follows:
            if str(self.second) == '60.0': self.second = 59.9

But when serialising the seconds field is stringified as '%06.3f'.

It is entirely possible that the line 277 check passes, but the format still yields '60.000', for 
instance for a float like 59.9999.

The fix is simply to alter the line 277 check to either if '%06.3f'%self.second == '60.000': ...
or in this instance a direct float value check of "if self.second > 59.999: ..." would suffice.

Also, the corrected value when the check fails should probably be 59.999 instead of the 
current 59.9.
msg4826 Author: [hidden] (ber) Date: 2013-03-21 21:21
Hi Erik,
thanks for the report and the suggestion to fix it.
Would you care for compiling a patch (with diff -u or so)
and a note for the Changes file and attach it here?
That would speed up our uptake of it. ;)

Best Regards,
Bernhard
msg4829 Author: [hidden] (nop-abc-se) Date: 2013-03-22 10:33
Find attached a proposed patch of date.py and CHANGES.txt.
msg4830 Author: [hidden] (ber) Date: 2013-03-22 11:10
4773:8ab5d7d63191

Thanks Erik!
History
Date User Action Args
2013-03-22 11:10:29bersetstatus: new -> closed
resolution: fixed
messages: + msg4830
2013-03-22 10:33:11nop-abc-sesetfiles: + roundup-issue2550802.patch
keywords: + patch
messages: + msg4829
2013-03-21 21:21:40bersetnosy: + ber
messages: + msg4826
2013-03-21 08:46:25nop-abc-secreate