Add three missing simplifications
This commit is contained in:
parent
72553fdfcf
commit
54a4efcd61
@ -171,16 +171,15 @@ def get_timeperiod(db, person):
|
|||||||
|
|
||||||
# no birth and death, look for another event date we can use
|
# no birth and death, look for another event date we can use
|
||||||
for event_ref in person.get_primary_event_ref_list():
|
for event_ref in person.get_primary_event_ref_list():
|
||||||
if event_ref:
|
event = db.get_event_from_handle(event_ref.ref)
|
||||||
event = db.get_event_from_handle(event_ref.ref)
|
if event:
|
||||||
if event:
|
event_date = event.get_date_object().to_calendar("gregorian")
|
||||||
event_date = event.get_date_object().to_calendar("gregorian")
|
if (
|
||||||
if (
|
event_date
|
||||||
event_date
|
and event_date.get_valid()
|
||||||
and event_date.get_valid()
|
and not event_date.is_empty()
|
||||||
and not event_date.is_empty()
|
):
|
||||||
):
|
return event_date.get_year()
|
||||||
return event_date.get_year()
|
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
@ -225,16 +224,15 @@ def get_marriage_or_fallback(db, family, format=None):
|
|||||||
|
|
||||||
# now search the event list for fallbacks
|
# now search the event list for fallbacks
|
||||||
for event_ref in get_primary_event_ref_list(db, family):
|
for event_ref in get_primary_event_ref_list(db, family):
|
||||||
if event_ref:
|
event = db.get_event_from_handle(event_ref.ref)
|
||||||
event = db.get_event_from_handle(event_ref.ref)
|
if (
|
||||||
if (
|
event
|
||||||
event
|
and event.type.is_marriage_fallback()
|
||||||
and event.type.is_marriage_fallback()
|
and event_ref.role in PRIMARY_EVENT_ROLES
|
||||||
and event_ref.role in PRIMARY_EVENT_ROLES
|
):
|
||||||
):
|
if format:
|
||||||
if format:
|
event.date.format = format
|
||||||
event.date.format = format
|
return event
|
||||||
return event
|
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
@ -251,16 +249,15 @@ def get_divorce_or_fallback(db, family, format=None):
|
|||||||
|
|
||||||
# now search the event list for fallbacks
|
# now search the event list for fallbacks
|
||||||
for event_ref in get_primary_event_ref_list(db, family):
|
for event_ref in get_primary_event_ref_list(db, family):
|
||||||
if event_ref:
|
event = db.get_event_from_handle(event_ref.ref)
|
||||||
event = db.get_event_from_handle(event_ref.ref)
|
if (
|
||||||
if (
|
event
|
||||||
event
|
and event.type.is_divorce_fallback()
|
||||||
and event.type.is_divorce_fallback()
|
and event_ref.role in PRIMARY_EVENT_ROLES
|
||||||
and event_ref.role in PRIMARY_EVENT_ROLES
|
):
|
||||||
):
|
if format:
|
||||||
if format:
|
event.date.format = format
|
||||||
event.date.format = format
|
return event
|
||||||
return event
|
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user