2008-02-25 Douglas S. Blank <dblank@cs.brynmawr.edu>

* src/DateHandler/_DateParser.py: set year += 1
	* src/gen/lib/date.py: removed slash-date fix
	* src/gen/lib/test/date_test.py: slash dates sort correctly



svn: r10121
This commit is contained in:
Doug Blank 2008-02-26 00:14:36 +00:00
parent 658d49407c
commit 7aed9fc1bf
4 changed files with 9 additions and 10 deletions

View File

@ -1,3 +1,8 @@
2008-02-25 Douglas S. Blank <dblank@cs.brynmawr.edu>
* src/DateHandler/_DateParser.py: set year += 1
* src/gen/lib/date.py: removed slash-date fix
* src/gen/lib/test/date_test.py: slash dates sort correctly
2008-02-25 Łukasz Rymarczyk <yenidai(at)poczta(dot)onet(dot)pl> 2008-02-25 Łukasz Rymarczyk <yenidai(at)poczta(dot)onet(dot)pl>
* src/const.py.in: query os.environ for GRAMPSHOME env and use it * src/const.py.in: query os.environ for GRAMPSHOME env and use it
0001831: A patch allowing using a different home folder than default 0001831: A patch allowing using a different home folder than default

View File

@ -595,7 +595,7 @@ class DateParser:
if date.get_slash(): if date.get_slash():
date.set_calendar(Date.CAL_JULIAN) date.set_calendar(Date.CAL_JULIAN)
date.set_year(date.get_year()) # forces recalc date.set_year(date.get_year() + 1) # year++ and forces recalc
def invert_year(self, subdate): def invert_year(self, subdate):
return (subdate[0], subdate[1], -subdate[2], subdate[3]) return (subdate[0], subdate[1], -subdate[2], subdate[3])

View File

@ -922,13 +922,6 @@ class Date:
""" """
if calendar == self.calendar: if calendar == self.calendar:
return return
if self.get_slash():
if (self.calendar == Date.CAL_JULIAN and
calendar == Date.CAL_GREGORIAN):
self.set_year(self.get_year() + 1)
elif (self.calendar == Date.CAL_GREGORIAN and
calendar == Date.CAL_JULIAN):
self.set_year(self.get_year() - 1)
(year, month, day) = Date._calendar_change[calendar](self.sortval) (year, month, day) = Date._calendar_change[calendar](self.sortval)
if self.is_compound(): if self.is_compound():
ryear = max(self.dateval[Date._POS_RYR], 1) ryear = max(self.dateval[Date._POS_RYR], 1)

View File

@ -301,6 +301,7 @@ def suite():
("jan 1, 2000/1", "jan 1, 2001", False), ("jan 1, 2000/1", "jan 1, 2001", False),
("jan 1, 2000/1", "jan 1, 2000/1", True), ("jan 1, 2000/1", "jan 1, 2000/1", True),
("jan 1, 2000/1", "jan 14, 2001", True), ("jan 1, 2000/1", "jan 14, 2001", True),
("jan 1, 2000/1", "jan 1, 2001 (julian)", True),
("about 1984", "about 2005", False), ("about 1984", "about 2005", False),
("about 1990", "about 2005", True), ("about 1990", "about 2005", True),
("about 2007", "about 2006", True), ("about 2007", "about 2006", True),
@ -372,6 +373,6 @@ def suite2():
return suite return suite
if __name__ == "__main__": if __name__ == "__main__":
unittest.TextTestRunner().run(suite())
unittest.TextTestRunner().run(suite2())
unittest.TextTestRunner().run(suite3()) unittest.TextTestRunner().run(suite3())
unittest.TextTestRunner().run(suite2())
unittest.TextTestRunner().run(suite())