From: richard Date: Thu, 4 Dec 2003 23:06:53 +0000 (+0000) Subject: - fixed date arithmetic to not allow day-of-month == 0 (sf bug 853306) X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=4ef722c82ac18acd32f19b2061746fc9daa3066a;p=roundup.git - fixed date arithmetic to not allow day-of-month == 0 (sf bug 853306) - fixed date arithmetic to limit hours-per-day to 24, not 60 git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@2009 57a73879-2fb5-44c3-a270-3262357dd7e2 --- diff --git a/CHANGES.txt b/CHANGES.txt index 2b856ee..b2a9409 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -10,12 +10,12 @@ Feature: - added postgresql backend (originally from sf patch 761740, many changes since) - all RDBMS backends now have indexes on several columns -- Change nosymessage and send_message to accept msgid=None (RFE #707235). -- Handle Resent-From: headers (sf bug 841151) -- Existing trackers (ie. live ones) may be used as templates for new +- change nosymessage and send_message to accept msgid=None (RFE #707235). +- handle Resent-From: headers (sf bug 841151) +- existing trackers (ie. live ones) may be used as templates for new trackers - the TEMPLATE-INFO.txt name entry has the tracker's dir name appended (so the demo tracker's template name is "classic-demo") -- Always sort MultilinkHTMLProperty in the correct order, usually +- always sort MultilinkHTMLProperty in the correct order, usually alphabetically (sf feature 790512). Fixed: @@ -23,16 +23,16 @@ Fixed: - added testing of schema mutation, fixed rdbms backends handling of a couple of cases - HTML 4.01 validation on the 'classic' backend -- Messages to the mailgw can be about classes other than issues now. -- Signature matching is more precise (sf bug 827775). -- Anonymous user can no longer edit or view itself (sf bug 828901). -- Corrected typo in installation.html (sf bug 822967). -- Clarified listTemplates docstring. -- Print a nicer error message when the address is already in use +- messages to the mailgw can be about classes other than issues now. +- signature matching is more precise (sf bug 827775). +- anonymous user can no longer edit or view itself (sf bug 828901). +- corrected typo in installation.html (sf bug 822967). +- clarified listTemplates docstring. +- print a nicer error message when the address is already in use (sf bug 798659). -- Remove empty lines before sending strings off to the csv parser +- remove empty lines before sending strings off to the csv parser (sf bug 821364). -- Centralised conversion of user-input data to hyperdb values (sf bug 802405, +- centralised conversion of user-input data to hyperdb values (sf bug 802405, sf bug 817217, sf rfe 816994) - recalculate SHA on template files when installed tracker used as template (sf bug 827510) @@ -42,35 +42,37 @@ Fixed: widget Cleanup: -- Replace curuserid attribute on Database with the extended getuid() method. -- Extract a new 'mailer' module for sending mail. -- Extract a '_send_mail' method for testing mail sending. -- Simplify backend importing. -- Use roundup_server in demo.py. -- Implement newItemAction using editItemAction. -- Use FormError in client.py, moving the handling up to inner_main(). -- Implemented semantic comparison of Message objects in test_mailgw. +- replace curuserid attribute on Database with the extended getuid() method. +- extract a new 'mailer' module for sending mail. +- extract a '_send_mail' method for testing mail sending. +- simplify backend importing. +- use roundup_server in demo.py. +- implement newItemAction using editItemAction. +- use FormError in client.py, moving the handling up to inner_main(). +- implemented semantic comparison of Message objects in test_mailgw. 2003-??-?? 0.6.4 Fixed: -- Hard-coded python2.3-ism (socket.timeout) fixed -- Fixed activity displaying as future because of Date arithmetic fix in 0.6.3 +- fixed date arithmetic to not allow day-of-month == 0 (sf bug 853306) +- fixed date arithmetic to limit hours-per-day to 24, not 60 +- hard-coded python2.3-ism (socket.timeout) fixed +- fixed activity displaying as future because of Date arithmetic fix in 0.6.3 (sf bug 842027). 2003-11-14 0.6.3 Fixed: -- Fixed detectors fix incorrectly fixed in bugfix release 0.6.2 -- Added note to upgrading doc for detectors fix in 0.6.2 -- Added script to help migrating queries from pre-0.6 trackers -- Fixed "documentation" of getnodeids in roundup.hyperdb -- Added flush() to DevNull (sf bug 835365) -- Fixed javascript for help window for only one checkbox case -- Date arithmetic was utterly broken, and has been for a long time. +- fixed detectors fix incorrectly fixed in bugfix release 0.6.2 +- added note to upgrading doc for detectors fix in 0.6.2 +- added script to help migrating queries from pre-0.6 trackers +- fixed "documentation" of getnodeids in roundup.hyperdb +- added flush() to DevNull (sf bug 835365) +- fixed javascript for help window for only one checkbox case +- date arithmetic was utterly broken, and has been for a long time. Date +/- Interval now works, and Date - Date also works (produces an Interval. -- Handle socket timeout exception (thanks Marcus Priesch) -- Fixed retirement of items in rdbms imports (sf bug 841355) -- Fixed bug in looking up journal of newly-created items in *dbm backends +- handle socket timeout exception (thanks Marcus Priesch) +- fixed retirement of items in rdbms imports (sf bug 841355) +- fixed bug in looking up journal of newly-created items in *dbm backends 2003-09-29 0.6.2 diff --git a/roundup/date.py b/roundup/date.py index b9fd398..b07bcf1 100644 --- a/roundup/date.py +++ b/roundup/date.py @@ -15,7 +15,7 @@ # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. # -# $Id: date.py,v 1.57 2003-11-19 22:53:15 jlgijsbers Exp $ +# $Id: date.py,v 1.58 2003-12-04 23:06:53 richard Exp $ __doc__ = """ Date, time and time interval handling. @@ -190,13 +190,13 @@ class Date: # now cope with under- and over-flow # first do the time while (second < 0 or second > 59 or minute < 0 or minute > 59 or - hour < 0 or hour > 59): + hour < 0 or hour > 23): if second < 0: minute -= 1; second += 60 elif second > 59: minute += 1; second -= 60 if minute < 0: hour -= 1; minute += 60 elif minute > 59: hour += 1; minute -= 60 if hour < 0: day -= 1; hour += 24 - elif hour > 59: day += 1; hour -= 24 + elif hour > 23: day += 1; hour -= 24 # fix up the month so we're within range while month < 1 or month > 12: @@ -204,13 +204,13 @@ class Date: if month > 12: year += 1; month -= 12 # now do the days, now that we know what month we're in - def get_mdays(year,month): + def get_mdays(year, month): if month == 2 and calendar.isleap(year): return 29 else: return calendar.mdays[month] - - while month < 1 or month > 12 or day < 0 or day > get_mdays(year,month): + + while month < 1 or month > 12 or day < 1 or day > get_mdays(year,month): # now to day under/over - if day < 0: + if day < 1: # When going backwards, decrement month, then increment days month -= 1 day += get_mdays(year,month) diff --git a/test/test_dates.py b/test/test_dates.py index 2c92aca..f213360 100644 --- a/test/test_dates.py +++ b/test/test_dates.py @@ -15,7 +15,7 @@ # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. # -# $Id: test_dates.py,v 1.30 2003-11-19 22:53:14 jlgijsbers Exp $ +# $Id: test_dates.py,v 1.31 2003-12-04 23:06:53 richard Exp $ from __future__ import nested_scopes import unittest, time @@ -122,6 +122,8 @@ class DateTestCase(unittest.TestCase): def testOffsetSub(self): ae = self.assertEqual + date = Date('2000-12-01') - Interval('- 1d') + date = Date('2000-01-01') - Interval('- 2y 2m') ae(str(date), '2002-03-01.00:00:00') date = Date('2000-01-01') - Interval('2m')