moved _make_date from Calendar.py, BirthdayReport.py, and WebCal.py into libholiday. Changed variable names in WebCal.py for improved readability.
svn: r11833
This commit is contained in:
@@ -42,7 +42,8 @@ import gen.lib
|
||||
from Utils import probably_alive, ProgressMeter
|
||||
from FontScale import string_trim
|
||||
|
||||
import libholiday
|
||||
import libholiday
|
||||
from libholiday import _make_date
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
@@ -58,14 +59,6 @@ def g2iso(dow):
|
||||
# ISO: MON = 1
|
||||
return (dow + 5) % 7 + 1
|
||||
|
||||
def make_date(year, month, day):
|
||||
"""
|
||||
Return a Date object of the particular year/month/day.
|
||||
"""
|
||||
retval = gen.lib.Date()
|
||||
retval.set_yr_mon_day(year, month, day)
|
||||
return retval
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# Calendar
|
||||
@@ -292,7 +285,7 @@ class Calendar(Report):
|
||||
father_lastname = father.get_primary_name().get_surname()
|
||||
short_name = self.get_name(person, father_lastname)
|
||||
if age >= 0:
|
||||
alive = probably_alive(person, self.database, make_date(self.year, month, day))
|
||||
alive = probably_alive(person, self.database, _make_date(self.year, month, day))
|
||||
if ((self.alive and alive) or not self.alive):
|
||||
self.add_day_item("%s, %d%s" % (short_name, age, ""), month, day)
|
||||
if self.anniversaries:
|
||||
@@ -337,8 +330,8 @@ class Calendar(Report):
|
||||
'person' : short_name,
|
||||
'nyears' : years,
|
||||
}
|
||||
alive1 = probably_alive(person, self.database, make_date(self.year, month, day))
|
||||
alive2 = probably_alive(spouse, self.database, make_date(self.year, month, day))
|
||||
alive1 = probably_alive(person, self.database, _make_date(self.year, month, day))
|
||||
alive2 = probably_alive(spouse, self.database, _make_date(self.year, month, day))
|
||||
if ((self.alive and alive1 and alive2) or not self.alive):
|
||||
self.add_day_item(text, month, day)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user