4192: [NarWeb] media is out of order in Places

svn: r15894
This commit is contained in:
Benny Malengier 2010-09-13 19:22:54 +00:00
parent 1df64c2609
commit 46c9eb079c

View File

@ -2083,20 +2083,18 @@ class IndividualListPage(BasePage):
trow += Html("td", self.person_link(url, person, False, gid = person.gramps_id), trow += Html("td", self.person_link(url, person, False, gid = person.gramps_id),
class_ = "ColumnName") class_ = "ColumnName")
# birth column # birth column
if showbirth: if showbirth:
tcell = Html("td", class_ = "ColumnBirth", inline = True) tcell = Html("td", class_ = "ColumnBirth", inline = True)
trow += tcell trow += tcell
birth_ref = person.get_birth_ref() birth_date = _find_birth_date(db, person)
if birth_ref: if birth_date is not None:
birth = db.get_event_from_handle(birth_ref.ref) if birth_date.fallback:
if birth: tcell += Html('em', _dd.display(birth_date), inline = True)
birth_date = _dd.display(birth.get_date_object()) else:
if birth.get_type() == EventType.BIRTH: tcell += _dd.display(birth_date)
tcell += birth_date
else:
tcell += Html('em', birth_date)
else: else:
tcell += " " tcell += " "
@ -2107,7 +2105,10 @@ class IndividualListPage(BasePage):
death_date = _find_death_date(db, person) death_date = _find_death_date(db, person)
if death_date is not None: if death_date is not None:
tcell += _dd.display(death_date) if death_date.fallback:
tcell += Html('em', _dd.display(death_date), inline = True)
else:
tcell += _dd.display(death_date)
else: else:
tcell += " " tcell += " "
@ -2249,15 +2250,13 @@ class SurnamePage(BasePage):
if showbirth: if showbirth:
tcell = Html("td", class_ = "ColumnBirth", inline = True) tcell = Html("td", class_ = "ColumnBirth", inline = True)
trow += tcell trow += tcell
birth_ref = person.get_birth_ref()
if birth_ref: birth_date = _find_birth_date(db, person)
birth = db.get_event_from_handle(birth_ref.ref) if birth_date is not None:
if birth: if birth_date.fallback:
birth_date = _dd.display(birth.get_date_object()) tcell += Html('em', _dd.display(birth_date), inline = True)
if birth.get_type() == EventType.BIRTH: else:
tcell += birth_date tcell += _dd.display(birth_date)
else:
tcell += Html('em', birth_date)
else: else:
tcell += " " tcell += " "
@ -2268,7 +2267,10 @@ class SurnamePage(BasePage):
death_date = _find_death_date(db, person) death_date = _find_death_date(db, person)
if death_date is not None: if death_date is not None:
tcell += _dd.display(death_date) if death_date.fallback:
tcell += Html('em', _dd.display(death_date), inline = True)
else:
tcell += _dd.display(death_date)
else: else:
tcell += " " tcell += " "
@ -6464,19 +6466,50 @@ def add_birthdate(db, childlist):
# return the list of child handles and their birthdates # return the list of child handles and their birthdates
return sorted_children return sorted_children
def _find_birth_date(db, person):
"""
will look for a birth date within the person's events
"""
date_out = None
birth_ref = person.get_birth_ref()
if birth_ref:
birth = db.get_event_from_handle(birth_ref.ref)
date_out = birth.get_date_object()
date_out.fallback = False
else:
event_list = person.get_primary_event_ref_list()
for event_ref in event_list:
event = db.get_event_from_handle(event_ref.ref)
if event.get_type().is_birth_fallback():
date_out = event.get_date_object()
date_out.fallback = True
log.debug("setting fallback to true for '%s'" % (event))
break
return date_out
def _find_death_date(db, person): def _find_death_date(db, person):
"""
will look for a death date within a person's events
"""
date_out = None
death_ref = person.get_death_ref() death_ref = 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:
return death.get_date_object() date_out = death.get_date_object()
date_out.fallback = False
else: else:
event_list = person.get_primary_event_ref_list() event_list = person.get_primary_event_ref_list()
for event_ref in event_list: for event_ref in event_list:
event = db.get_event_from_handle(event_ref.ref) event = db.get_event_from_handle(event_ref.ref)
if event.get_type().is_death_fallback(): if event.get_type().is_death_fallback():
return event.get_date_object() date_out = event.get_date_object()
return None date_out.fallback = True
break
return date_out
def build_event_data(db, ind_list): def build_event_data(db, ind_list):
""" """