Date part of issue 4160. Use of option Use full dates instead of full year works again.

svn: r15713
This commit is contained in:
Peter Landgren 2010-08-12 06:02:16 +00:00
parent b3e313d5ce
commit f378a193e0

View File

@ -1453,7 +1453,7 @@ class Narrator(object):
Narrator is a class which provides narration text. Narrator is a class which provides narration text.
""" """
def __init__(self, dbase, verbose=True, use_call_name=False, def __init__(self, dbase, verbose=True, use_call_name=False,use_fulldate=False,
empty_date="", empty_place="", empty_date="", empty_place="",
translator=None, translator=None,
get_endnote_numbers=_get_empty_endnote_numbers): get_endnote_numbers=_get_empty_endnote_numbers):
@ -1485,6 +1485,7 @@ class Narrator(object):
self.__db = dbase self.__db = dbase
self.__verbose = verbose self.__verbose = verbose
self.__use_call = use_call_name self.__use_call = use_call_name
self.__use_fulldate = use_fulldate
self.__empty_date = empty_date self.__empty_date = empty_date
self.__empty_place = empty_place self.__empty_place = empty_place
self.__get_endnote_numbers = get_endnote_numbers self.__get_endnote_numbers = get_endnote_numbers
@ -1545,7 +1546,10 @@ class Narrator(object):
if birth_ref and birth_ref.ref: if birth_ref and birth_ref.ref:
birth_event = self.__db.get_event_from_handle(birth_ref.ref) birth_event = self.__db.get_event_from_handle(birth_ref.ref)
if birth_event: if birth_event:
if self.__use_fulldate :
bdate = self.__get_date(birth_event.get_date_object()) bdate = self.__get_date(birth_event.get_date_object())
else:
bdate = birth_event.get_date_object().get_year()
bplace_handle = birth_event.get_place_handle() bplace_handle = birth_event.get_place_handle()
if bplace_handle: if bplace_handle:
place = self.__db.get_place_from_handle(bplace_handle) place = self.__db.get_place_from_handle(bplace_handle)
@ -1656,7 +1660,10 @@ class Narrator(object):
if death_ref and death_ref.ref: if death_ref and death_ref.ref:
death_event = self.__db.get_event_from_handle(death_ref.ref) death_event = self.__db.get_event_from_handle(death_ref.ref)
if death_event: if death_event:
if self.__use_fulldate :
ddate = self.__get_date(death_event.get_date_object()) ddate = self.__get_date(death_event.get_date_object())
else:
ddate = death_event.get_date_object().get_year()
dplace_handle = death_event.get_place_handle() dplace_handle = death_event.get_place_handle()
if dplace_handle: if dplace_handle:
place = self.__db.get_place_from_handle(dplace_handle) place = self.__db.get_place_from_handle(dplace_handle)
@ -1772,7 +1779,10 @@ class Narrator(object):
break break
if burial: if burial:
if self.__use_fulldate :
bdate = self.__get_date(burial.get_date_object()) bdate = self.__get_date(burial.get_date_object())
else:
bdate = burial.get_date_object().get_year()
bplace_handle = burial.get_place_handle() bplace_handle = burial.get_place_handle()
if bplace_handle: if bplace_handle:
place = self.__db.get_place_from_handle(bplace_handle) place = self.__db.get_place_from_handle(bplace_handle)
@ -1879,7 +1889,10 @@ class Narrator(object):
break break
if baptism: if baptism:
if self.__use_fulldate :
bdate = self.__get_date(baptism.get_date_object()) bdate = self.__get_date(baptism.get_date_object())
else:
bdate = baptism.get_date_object().get_year()
bplace_handle = baptism.get_place_handle() bplace_handle = baptism.get_place_handle()
if bplace_handle: if bplace_handle:
place = self.__db.get_place_from_handle(bplace_handle) place = self.__db.get_place_from_handle(bplace_handle)
@ -1986,7 +1999,10 @@ class Narrator(object):
break break
if christening: if christening:
if self.__use_fulldate :
cdate = self.__get_date(christening.get_date_object()) cdate = self.__get_date(christening.get_date_object())
else:
cdate = christening.get_date_object().get_year()
cplace_handle = christening.get_place_handle() cplace_handle = christening.get_place_handle()
if cplace_handle: if cplace_handle:
place = self.__db.get_place_from_handle(cplace_handle) place = self.__db.get_place_from_handle(cplace_handle)
@ -2087,7 +2103,10 @@ class Narrator(object):
spouse_name = _nd.display(spouse) spouse_name = _nd.display(spouse)
if event: if event:
if self.__use_fulldate :
mdate = self.__get_date(event.get_date_object()) mdate = self.__get_date(event.get_date_object())
else:
mdate = event.get_date_object().get_year()
if mdate: if mdate:
date = mdate date = mdate
place_handle = event.get_place_handle() place_handle = event.get_place_handle()