7089: webcal mistreats non-gregorian event dates

svn: r23209
This commit is contained in:
Vassilii Khachaturov 2013-09-26 22:06:15 +00:00
parent 3381140ec0
commit 08dc8ffc53

View File

@ -577,7 +577,7 @@ class WebCalReport(Report):
elif url_fname == 'fullyearlinked': elif url_fname == 'fullyearlinked':
myTitle = _('Full year at a Glance') myTitle = _('Full year at a Glance')
else: else:
myTitle = _(url_fname) myTitle = _(url_fname)
hyper = Html("a", nav_text, href = url, name = url_fname, title = myTitle) hyper = Html("a", nav_text, href = url, name = url_fname, title = myTitle)
if check_cs: if check_cs:
@ -1099,6 +1099,7 @@ class WebCalReport(Report):
# determine birthday information??? # determine birthday information???
if (self.birthday and birth_date is not Date.EMPTY and birth_date.is_valid()): if (self.birthday and birth_date is not Date.EMPTY and birth_date.is_valid()):
birth_date = gregorian(birth_date)
year = birth_date.get_year() or this_year year = birth_date.get_year() or this_year
month = birth_date.get_month() month = birth_date.get_month()
@ -1162,6 +1163,7 @@ class WebCalReport(Report):
if marriage_event: if marriage_event:
event_date = marriage_event.get_date_object() event_date = marriage_event.get_date_object()
if event_date is not Date.EMPTY and event_date.is_valid(): if event_date is not Date.EMPTY and event_date.is_valid():
event_date = gregorian(event_date)
year = event_date.get_year() year = event_date.get_year()
month = event_date.get_month() month = event_date.get_month()
day = event_date.get_day() day = event_date.get_day()
@ -1725,3 +1727,10 @@ def get_day_list(event_date, holiday_list, bday_anniv_list):
# return to its caller calendar_build() # return to its caller calendar_build()
return day_list return day_list
def gregorian(date):
"""Convert given date to gregorian. Doesn't modify the original object."""
if date.get_calendar() != Date.CAL_GREGORIAN:
date = Date(date)
date.convert_calendar(Date.CAL_GREGORIAN)
return date