9945: Write PlaceID links in CSV export
When places are included in the export use PlaceID links, otherwise generate a formatted place for the event.
This commit is contained in:
parent
f3e11efeaf
commit
9ca01a3211
@ -401,9 +401,7 @@ class CSVWriter:
|
|||||||
birth = self.db.get_event_from_handle(birth_ref.ref)
|
birth = self.db.get_event_from_handle(birth_ref.ref)
|
||||||
if birth:
|
if birth:
|
||||||
birthdate = self.format_date( birth)
|
birthdate = self.format_date( birth)
|
||||||
place_handle = birth.get_place_handle()
|
birthplace = self.format_place(birth)
|
||||||
if place_handle:
|
|
||||||
birthplace = _pd.display_event(self.db, birth)
|
|
||||||
birthsource = get_primary_source_title(self.db, birth)
|
birthsource = get_primary_source_title(self.db, birth)
|
||||||
# Baptism:
|
# Baptism:
|
||||||
baptismdate = ""
|
baptismdate = ""
|
||||||
@ -415,9 +413,7 @@ class CSVWriter:
|
|||||||
baptism = self.db.get_event_from_handle(baptism_ref.ref)
|
baptism = self.db.get_event_from_handle(baptism_ref.ref)
|
||||||
if baptism:
|
if baptism:
|
||||||
baptismdate = self.format_date( baptism)
|
baptismdate = self.format_date( baptism)
|
||||||
place_handle = baptism.get_place_handle()
|
baptismplace = self.format_place(baptism)
|
||||||
if place_handle:
|
|
||||||
baptismplace = _pd.display_event(self.db, baptism)
|
|
||||||
baptismsource = get_primary_source_title(self.db, baptism)
|
baptismsource = get_primary_source_title(self.db, baptism)
|
||||||
# Death:
|
# Death:
|
||||||
deathdate = ""
|
deathdate = ""
|
||||||
@ -428,9 +424,7 @@ class CSVWriter:
|
|||||||
death = self.db.get_event_from_handle(death_ref.ref)
|
death = self.db.get_event_from_handle(death_ref.ref)
|
||||||
if death:
|
if death:
|
||||||
deathdate = self.format_date( death)
|
deathdate = self.format_date( death)
|
||||||
place_handle = death.get_place_handle()
|
deathplace = self.format_place(death)
|
||||||
if place_handle:
|
|
||||||
deathplace = _pd.display_event(self.db, death)
|
|
||||||
deathsource = get_primary_source_title(self.db, death)
|
deathsource = get_primary_source_title(self.db, death)
|
||||||
# Burial:
|
# Burial:
|
||||||
burialdate = ""
|
burialdate = ""
|
||||||
@ -442,9 +436,7 @@ class CSVWriter:
|
|||||||
burial = self.db.get_event_from_handle(burial_ref.ref)
|
burial = self.db.get_event_from_handle(burial_ref.ref)
|
||||||
if burial:
|
if burial:
|
||||||
burialdate = self.format_date( burial)
|
burialdate = self.format_date( burial)
|
||||||
place_handle = burial.get_place_handle()
|
burialplace = self.format_place(burial)
|
||||||
if place_handle:
|
|
||||||
burialplace = _pd.display_event(self.db, burial)
|
|
||||||
burialsource = get_primary_source_title(self.db, burial)
|
burialsource = get_primary_source_title(self.db, burial)
|
||||||
# Write it out:
|
# Write it out:
|
||||||
self.write_csv(grampsid_ref, surname, first_name, callname,
|
self.write_csv(grampsid_ref, surname, first_name, callname,
|
||||||
@ -502,9 +494,7 @@ class CSVWriter:
|
|||||||
event = self.db.get_event_from_handle(event_ref.ref)
|
event = self.db.get_event_from_handle(event_ref.ref)
|
||||||
if event.get_type() == EventType.MARRIAGE:
|
if event.get_type() == EventType.MARRIAGE:
|
||||||
mdate = self.format_date( event)
|
mdate = self.format_date( event)
|
||||||
place_handle = event.get_place_handle()
|
mplace = self.format_place(event)
|
||||||
if place_handle:
|
|
||||||
mplace = _pd.display_event(self.db, event)
|
|
||||||
source = get_primary_source_title(self.db, event)
|
source = get_primary_source_title(self.db, event)
|
||||||
note = ''
|
note = ''
|
||||||
self.write_csv(marriage_id, father_id, mother_id, mdate,
|
self.write_csv(marriage_id, father_id, mother_id, mdate,
|
||||||
@ -537,3 +527,18 @@ class CSVWriter:
|
|||||||
|
|
||||||
def format_date(self, date):
|
def format_date(self, date):
|
||||||
return get_date(date)
|
return get_date(date)
|
||||||
|
|
||||||
|
def format_place(self, event):
|
||||||
|
"""
|
||||||
|
If places are included in the export return a link, else return a
|
||||||
|
formatted place for the given event.
|
||||||
|
"""
|
||||||
|
if self.include_places:
|
||||||
|
place_handle = event.get_place_handle()
|
||||||
|
if place_handle:
|
||||||
|
place = self.db.get_place_from_handle(place_handle)
|
||||||
|
if place:
|
||||||
|
return "[%s]" % place.get_gramps_id()
|
||||||
|
return ""
|
||||||
|
else:
|
||||||
|
return _pd.display_event(self.db, event)
|
||||||
|
Loading…
Reference in New Issue
Block a user