Skip to content

Commit ae8c8ce

Browse files
author
Richard Jones
committed
fixed date arithmetic to not allow day-of-month == 0 [SF#853306]
fixed date arithmetic to limit hours-per-day to 24, not 60
1 parent 7a2a9e3 commit ae8c8ce

File tree

3 files changed

+44
-40
lines changed

3 files changed

+44
-40
lines changed

CHANGES.txt

Lines changed: 34 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -10,29 +10,29 @@ Feature:
1010
- added postgresql backend (originally from sf patch 761740, many changes
1111
since)
1212
- all RDBMS backends now have indexes on several columns
13-
- Change nosymessage and send_message to accept msgid=None (RFE #707235).
14-
- Handle Resent-From: headers (sf bug 841151)
15-
- Existing trackers (ie. live ones) may be used as templates for new
13+
- change nosymessage and send_message to accept msgid=None (RFE #707235).
14+
- handle Resent-From: headers (sf bug 841151)
15+
- existing trackers (ie. live ones) may be used as templates for new
1616
trackers - the TEMPLATE-INFO.txt name entry has the tracker's dir name
1717
appended (so the demo tracker's template name is "classic-demo")
18-
- Always sort MultilinkHTMLProperty in the correct order, usually
18+
- always sort MultilinkHTMLProperty in the correct order, usually
1919
alphabetically (sf feature 790512).
2020

2121
Fixed:
2222
- mysql documentation fixed to note requirement of 4.0+ and InnoDB
2323
- added testing of schema mutation, fixed rdbms backends handling of a
2424
couple of cases
2525
- HTML 4.01 validation on the 'classic' backend
26-
- Messages to the mailgw can be about classes other than issues now.
27-
- Signature matching is more precise (sf bug 827775).
28-
- Anonymous user can no longer edit or view itself (sf bug 828901).
29-
- Corrected typo in installation.html (sf bug 822967).
30-
- Clarified listTemplates docstring.
31-
- Print a nicer error message when the address is already in use
26+
- messages to the mailgw can be about classes other than issues now.
27+
- signature matching is more precise (sf bug 827775).
28+
- anonymous user can no longer edit or view itself (sf bug 828901).
29+
- corrected typo in installation.html (sf bug 822967).
30+
- clarified listTemplates docstring.
31+
- print a nicer error message when the address is already in use
3232
(sf bug 798659).
33-
- Remove empty lines before sending strings off to the csv parser
33+
- remove empty lines before sending strings off to the csv parser
3434
(sf bug 821364).
35-
- Centralised conversion of user-input data to hyperdb values (sf bug 802405,
35+
- centralised conversion of user-input data to hyperdb values (sf bug 802405,
3636
sf bug 817217, sf rfe 816994)
3737
- recalculate SHA on template files when installed tracker used as
3838
template (sf bug 827510)
@@ -42,35 +42,37 @@ Fixed:
4242
widget
4343

4444
Cleanup:
45-
- Replace curuserid attribute on Database with the extended getuid() method.
46-
- Extract a new 'mailer' module for sending mail.
47-
- Extract a '_send_mail' method for testing mail sending.
48-
- Simplify backend importing.
49-
- Use roundup_server in demo.py.
50-
- Implement newItemAction using editItemAction.
51-
- Use FormError in client.py, moving the handling up to inner_main().
52-
- Implemented semantic comparison of Message objects in test_mailgw.
45+
- replace curuserid attribute on Database with the extended getuid() method.
46+
- extract a new 'mailer' module for sending mail.
47+
- extract a '_send_mail' method for testing mail sending.
48+
- simplify backend importing.
49+
- use roundup_server in demo.py.
50+
- implement newItemAction using editItemAction.
51+
- use FormError in client.py, moving the handling up to inner_main().
52+
- implemented semantic comparison of Message objects in test_mailgw.
5353

5454
2003-??-?? 0.6.4
5555
Fixed:
56-
- Hard-coded python2.3-ism (socket.timeout) fixed
57-
- Fixed activity displaying as future because of Date arithmetic fix in 0.6.3
56+
- fixed date arithmetic to not allow day-of-month == 0 (sf bug 853306)
57+
- fixed date arithmetic to limit hours-per-day to 24, not 60
58+
- hard-coded python2.3-ism (socket.timeout) fixed
59+
- fixed activity displaying as future because of Date arithmetic fix in 0.6.3
5860
(sf bug 842027).
5961

6062
2003-11-14 0.6.3
6163
Fixed:
62-
- Fixed detectors fix incorrectly fixed in bugfix release 0.6.2
63-
- Added note to upgrading doc for detectors fix in 0.6.2
64-
- Added script to help migrating queries from pre-0.6 trackers
65-
- Fixed "documentation" of getnodeids in roundup.hyperdb
66-
- Added flush() to DevNull (sf bug 835365)
67-
- Fixed javascript for help window for only one checkbox case
68-
- Date arithmetic was utterly broken, and has been for a long time.
64+
- fixed detectors fix incorrectly fixed in bugfix release 0.6.2
65+
- added note to upgrading doc for detectors fix in 0.6.2
66+
- added script to help migrating queries from pre-0.6 trackers
67+
- fixed "documentation" of getnodeids in roundup.hyperdb
68+
- added flush() to DevNull (sf bug 835365)
69+
- fixed javascript for help window for only one checkbox case
70+
- date arithmetic was utterly broken, and has been for a long time.
6971
Date +/- Interval now works, and Date - Date also works (produces
7072
an Interval.
71-
- Handle socket timeout exception (thanks Marcus Priesch)
72-
- Fixed retirement of items in rdbms imports (sf bug 841355)
73-
- Fixed bug in looking up journal of newly-created items in *dbm backends
73+
- handle socket timeout exception (thanks Marcus Priesch)
74+
- fixed retirement of items in rdbms imports (sf bug 841355)
75+
- fixed bug in looking up journal of newly-created items in *dbm backends
7476

7577

7678
2003-09-29 0.6.2

roundup/date.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
1616
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
1717
#
18-
# $Id: date.py,v 1.57 2003-11-19 22:53:15 jlgijsbers Exp $
18+
# $Id: date.py,v 1.58 2003-12-04 23:06:53 richard Exp $
1919

2020
__doc__ = """
2121
Date, time and time interval handling.
@@ -190,27 +190,27 @@ def addInterval(self, interval):
190190
# now cope with under- and over-flow
191191
# first do the time
192192
while (second < 0 or second > 59 or minute < 0 or minute > 59 or
193-
hour < 0 or hour > 59):
193+
hour < 0 or hour > 23):
194194
if second < 0: minute -= 1; second += 60
195195
elif second > 59: minute += 1; second -= 60
196196
if minute < 0: hour -= 1; minute += 60
197197
elif minute > 59: hour += 1; minute -= 60
198198
if hour < 0: day -= 1; hour += 24
199-
elif hour > 59: day += 1; hour -= 24
199+
elif hour > 23: day += 1; hour -= 24
200200

201201
# fix up the month so we're within range
202202
while month < 1 or month > 12:
203203
if month < 1: year -= 1; month += 12
204204
if month > 12: year += 1; month -= 12
205205

206206
# now do the days, now that we know what month we're in
207-
def get_mdays(year,month):
207+
def get_mdays(year, month):
208208
if month == 2 and calendar.isleap(year): return 29
209209
else: return calendar.mdays[month]
210-
211-
while month < 1 or month > 12 or day < 0 or day > get_mdays(year,month):
210+
211+
while month < 1 or month > 12 or day < 1 or day > get_mdays(year,month):
212212
# now to day under/over
213-
if day < 0:
213+
if day < 1:
214214
# When going backwards, decrement month, then increment days
215215
month -= 1
216216
day += get_mdays(year,month)

test/test_dates.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
1616
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
1717
#
18-
# $Id: test_dates.py,v 1.30 2003-11-19 22:53:14 jlgijsbers Exp $
18+
# $Id: test_dates.py,v 1.31 2003-12-04 23:06:53 richard Exp $
1919
from __future__ import nested_scopes
2020

2121
import unittest, time
@@ -122,6 +122,8 @@ def testOffsetAdd(self):
122122

123123
def testOffsetSub(self):
124124
ae = self.assertEqual
125+
date = Date('2000-12-01') - Interval('- 1d')
126+
125127
date = Date('2000-01-01') - Interval('- 2y 2m')
126128
ae(str(date), '2002-03-01.00:00:00')
127129
date = Date('2000-01-01') - Interval('2m')

0 commit comments

Comments
 (0)