2007-11-21 Douglas S. Blank <dblank@cs.brynmawr.edu>

* src/Utils.py: probably_alive now takes date rather than year
	* src/gen/proxy/living.py: create date from year
	* src/gen/lib/date.py: added methods to do date math
	  and return Date object (set_yr_mon_day_offset, copy_offset_ymd)
	* src/plugins/Calendar.py: updated to use probably alive date
	* src/Filters/Rules/Person/_ProbablyAlive.py: parse entry as date



svn: r9379
This commit is contained in:
Doug Blank
2007-11-21 14:49:50 +00:00
parent f8076631d3
commit 9ee75010b6
6 changed files with 92 additions and 48 deletions

View File

@ -537,6 +537,25 @@ class Date:
self.dateval = tuple(dv)
self._calc_sort_value()
def set_yr_mon_day_offset(self, year=0, month=0, day=0):
"""
Sets the year, month, and day values by offset
"""
dv = list(self.dateval)
dv[Date._POS_YR] += year
dv[Date._POS_MON] += month
dv[Date._POS_DAY] += day
self.dateval = tuple(dv)
self._calc_sort_value()
def copy_offset_ymd(self, year=0, month=0, day=0):
"""
Returns a Date copy based on year, month, and day offset
"""
retval = Date(self)
retval.set_yr_mon_day_offset(year, month, day)
return retval
def set_year(self, year):
"""
Sets the year value
@ -760,7 +779,6 @@ class Date:
"""
return Date._calendar_change[Date.CAL_GREGORIAN](self.sortval + value)
# if __name__ == "__main__":
# # Test function. Call it as follows from the command line (so as to find
# # imported modules):