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
0ab7c316f0
commit
8c7133ab00
@ -400,9 +400,7 @@ class CSVWriter(object):
|
|||||||
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 = ""
|
||||||
@ -414,9 +412,7 @@ class CSVWriter(object):
|
|||||||
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 = ""
|
||||||
@ -427,9 +423,7 @@ class CSVWriter(object):
|
|||||||
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 = ""
|
||||||
@ -441,9 +435,7 @@ class CSVWriter(object):
|
|||||||
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,
|
||||||
@ -501,10 +493,8 @@ class CSVWriter(object):
|
|||||||
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:
|
source = get_primary_source_title(self.db, event)
|
||||||
mplace = _pd.display_event(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,
|
||||||
mplace, source, note)
|
mplace, source, note)
|
||||||
@ -536,3 +526,18 @@ class CSVWriter(object):
|
|||||||
|
|
||||||
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