Kept place source references and fixed a crash.
svn: r13692
This commit is contained in:
parent
393d547d6e
commit
b6f8cd5ee6
@ -2034,6 +2034,7 @@ class PlacePage(BasePage):
|
|||||||
|
|
||||||
def __init__(self, report, title, place_handle, src_list, place_list):
|
def __init__(self, report, title, place_handle, src_list, place_list):
|
||||||
""" creates the individual place pages """
|
""" creates the individual place pages """
|
||||||
|
self.bibli = Bibliography()
|
||||||
db = report.database
|
db = report.database
|
||||||
|
|
||||||
place = db.get_place_from_handle(place_handle)
|
place = db.get_place_from_handle(place_handle)
|
||||||
@ -2082,6 +2083,11 @@ class PlacePage(BasePage):
|
|||||||
if urllinks is not None:
|
if urllinks is not None:
|
||||||
placedetail += urllinks
|
placedetail += urllinks
|
||||||
|
|
||||||
|
# source references
|
||||||
|
srcrefs = self.display_ind_sources(place)
|
||||||
|
if srcrefs is not None:
|
||||||
|
placedetail += srcrefs
|
||||||
|
|
||||||
# place references
|
# place references
|
||||||
reflist = self.display_references(place_list[place.handle])
|
reflist = self.display_references(place_list[place.handle])
|
||||||
if reflist is not None:
|
if reflist is not None:
|
||||||
@ -2377,7 +2383,8 @@ class MediaPage(BasePage):
|
|||||||
# get all of the backlinks to this media object; meaning all of
|
# get all of the backlinks to this media object; meaning all of
|
||||||
# the people, events, places, etc..., that use this image
|
# the people, events, places, etc..., that use this image
|
||||||
_region_items = set()
|
_region_items = set()
|
||||||
for (classname, newhandle) in db.find_backlink_handles(handle):
|
for (classname, newhandle) in db.find_backlink_handles(handle,
|
||||||
|
include_classes = ["Person", "Family", "Event", "Place"]):
|
||||||
|
|
||||||
# for each of the backlinks, get the relevant object from the db
|
# for each of the backlinks, get the relevant object from the db
|
||||||
# and determine a few important things, such as a text name we
|
# and determine a few important things, such as a text name we
|
||||||
@ -2392,9 +2399,28 @@ class MediaPage(BasePage):
|
|||||||
if not _name or _name == "":
|
if not _name or _name == "":
|
||||||
_name = _obj.get_primary_name().get_first_name()
|
_name = _obj.get_primary_name().get_first_name()
|
||||||
_linkurl = report.build_url_fname_html(_obj.handle, "ppl", True)
|
_linkurl = report.build_url_fname_html(_obj.handle, "ppl", True)
|
||||||
|
elif classname == "Family":
|
||||||
|
_obj = db.get_family_from_handle(newhandle)
|
||||||
|
partner1_handle = _obj.get_father_handle()
|
||||||
|
partner2_handle = _obj.get_mother_handle()
|
||||||
|
if partner1_handle:
|
||||||
|
partner1 = db.get_person_from_handle(partner1_handle)
|
||||||
|
if partner2_handle:
|
||||||
|
partner2 = db.get_person_from_handle(partner2_handle)
|
||||||
|
if partner2 and partner1:
|
||||||
|
_name = partner1.get_primary_name().get_first_name()
|
||||||
|
elif partner1:
|
||||||
|
_name = partner1.get_primary_name().get_first_name()
|
||||||
|
elif partner2:
|
||||||
|
_name = partner2.get_primary_name().get_first_name()
|
||||||
|
_linkurl = report.build_url_fname_html(partner1_handle, "ppl", True)
|
||||||
elif classname == "Event":
|
elif classname == "Event":
|
||||||
_obj = db.get_event_from_handle( newhandle )
|
_obj = db.get_event_from_handle( newhandle )
|
||||||
_name = _obj.get_description()
|
_name = _obj.get_description()
|
||||||
|
elif classname == "Place":
|
||||||
|
_obj = db.get_place_from_handle(newhandle)
|
||||||
|
_name = ReportUtils.place_name(db, newhandle)
|
||||||
|
_linkurl = report.build_url_fname_html(newhandle, "plc", True)
|
||||||
|
|
||||||
# continue looking through the loop for an object...
|
# continue looking through the loop for an object...
|
||||||
if _obj is None:
|
if _obj is None:
|
||||||
@ -3829,24 +3855,24 @@ class IndividualPage(BasePage):
|
|||||||
table += trow
|
table += trow
|
||||||
|
|
||||||
# Age At Death???
|
# Age At Death???
|
||||||
birth_date = None
|
birth_date = Date.EMPTY
|
||||||
birth_ref = self.person.get_birth_ref()
|
birth_ref = self.person.get_birth_ref()
|
||||||
if birth_ref:
|
if birth_ref:
|
||||||
birth = db.get_event_from_handle(birth_ref.ref)
|
birth = db.get_event_from_handle(birth_ref.ref)
|
||||||
if birth:
|
if birth:
|
||||||
birth_date = birth.get_date_object()
|
birth_date = birth.get_date_object()
|
||||||
|
|
||||||
if birth_date is not None and birth_date != Date.EMPTY:
|
if birth_date and birth_date is not Date.EMPTY:
|
||||||
alive = Utils.probably_alive(self.person, db, date.Today() )
|
alive = Utils.probably_alive(self.person, db, date.Today() )
|
||||||
|
|
||||||
death_date = None
|
death_date = Date.EMPTY
|
||||||
death_ref = self.person.get_death_ref()
|
death_ref = self.person.get_death_ref()
|
||||||
if death_ref:
|
if death_ref:
|
||||||
death = db.get_event_from_handle(death_ref.ref)
|
death = db.get_event_from_handle(death_ref.ref)
|
||||||
if death:
|
if death:
|
||||||
death_date = death.get_date_object()
|
death_date = death.get_date_object()
|
||||||
|
|
||||||
if not alive and (death_date is not None and death_date != Date.EMPTY):
|
if not alive and (death_date and death_date is not Date.EMPTY):
|
||||||
nyears = death_date - birth_date
|
nyears = death_date - birth_date
|
||||||
nyears.format(precision = 3)
|
nyears.format(precision = 3)
|
||||||
trow = Html("tr") + (
|
trow = Html("tr") + (
|
||||||
@ -3855,26 +3881,6 @@ class IndividualPage(BasePage):
|
|||||||
)
|
)
|
||||||
table += trow
|
table += trow
|
||||||
|
|
||||||
# time since they passed away
|
|
||||||
nyears = date.Today() - death_date
|
|
||||||
nyears.format(precision = 3)
|
|
||||||
|
|
||||||
# get appropriate gender pronoun
|
|
||||||
if gender == Person.FEMALE:
|
|
||||||
gdr_str = "she"
|
|
||||||
elif gender == Person.MALE:
|
|
||||||
gdr_str = "he"
|
|
||||||
else:
|
|
||||||
gdr_str = "unknown"
|
|
||||||
|
|
||||||
time_str = _("It has been %(time)s, since %(gdr_str)s has died..") % {
|
|
||||||
'time' : nyears, 'gdr_str' : gdr_str }
|
|
||||||
trow = Html("tr") + (
|
|
||||||
Html("td", " ", class_ = "ColumnAttribute", inline = True),
|
|
||||||
Html("td", time_str, class_ = "ColumnValue", inline = True)
|
|
||||||
)
|
|
||||||
table += trow
|
|
||||||
|
|
||||||
# return all three pieces to its caller
|
# return all three pieces to its caller
|
||||||
# do NOT combine before returning to class IndividualPage
|
# do NOT combine before returning to class IndividualPage
|
||||||
return thumbnail, section_title, summaryarea
|
return thumbnail, section_title, summaryarea
|
||||||
|
Loading…
Reference in New Issue
Block a user