Mercurial > p > roundup > code
changeset 3028:de242e68c69b
fix py2.4 strftime() API change bug [SF#1087746]
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Mon, 03 Jan 2005 03:05:31 +0000 |
| parents | 7032b500b7e0 |
| children | 0a81ed2b397d |
| files | CHANGES.txt roundup/date.py |
| diffstat | 2 files changed, 10 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/CHANGES.txt Mon Jan 03 02:58:00 2005 +0000 +++ b/CHANGES.txt Mon Jan 03 03:05:31 2005 +0000 @@ -67,6 +67,7 @@ - fix roundup-admin find command handling of Multilinks - fix some security assertions (sf bug 1085481) - don't set the title to nothing from incoming mail (thanks Bruce Guenter) +- fix py2.4 strftime() API change bug (sf bug 1087746) 2004-10-26 0.7.9
--- a/roundup/date.py Mon Jan 03 02:58:00 2005 +0000 +++ b/roundup/date.py Mon Jan 03 03:05:31 2005 +0000 @@ -15,7 +15,7 @@ # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. # -# $Id: date.py,v 1.77 2004-11-29 14:32:55 a1s Exp $ +# $Id: date.py,v 1.78 2005-01-03 03:05:31 richard Exp $ """Date, time and time interval handling. """ @@ -367,8 +367,14 @@ Note that if the day is zero, and the day appears first in the format, then the day number will be removed from output. ''' - str = time.strftime(format, (self.year, self.month, self.day, - self.hour, self.minute, int(self.second), 0, 0, 0)) + # Python2.4 strftime() enforces the non-zero-ness of the day-of-year + # component of the time tuple, so we need to figure it out + t = (self.year, self.month, self.day, self.hour, self.minute, + int(self.second), 0, 0, 0) + t = calendar.timegm(t) + t = time.gmtime(t) + str = time.strftime(format, t) + # handle zero day by removing it if format.startswith('%d') and str[0] == '0': return ' ' + str[1:]
