9242: multiple lines on firstname can corrupt ODT file

fix gramps XML file via import/export but do not know the cause
This commit is contained in:
romjerome 2016-03-07 15:05:19 +01:00
parent 1cfd71001c
commit 79c193f74b
2 changed files with 9 additions and 1 deletions

View File

@ -979,6 +979,11 @@ class GrampsXmlWriter(UpdateCallback):
def dump_name(self, name,alternative=False,index=1): def dump_name(self, name,alternative=False,index=1):
sp = " "*index sp = " "*index
name_type = name.get_type().xml_str() name_type = name.get_type().xml_str()
# bug 9242
if len(name.get_first_name().splitlines()) != 1:
firstname = "".join(name.get_first_name().splitlines())
else:
firstname = name.get_first_name()
self.g.write('%s<name' % sp) self.g.write('%s<name' % sp)
if alternative: if alternative:
self.g.write(' alt="1"') self.g.write(' alt="1"')
@ -991,7 +996,7 @@ class GrampsXmlWriter(UpdateCallback):
if name.get_display_as() != 0: if name.get_display_as() != 0:
self.g.write(' display="%d"' % name.get_display_as()) self.g.write(' display="%d"' % name.get_display_as())
self.g.write('>\n') self.g.write('>\n')
self.write_line("first", name.get_first_name(), index+1) self.write_line("first", firstname, index+1)
self.write_line("call", name.get_call_name(), index+1) self.write_line("call", name.get_call_name(), index+1)
for surname in name.get_surname_list(): for surname in name.get_surname_list():
self.write_surname(surname,index+1) self.write_surname(surname,index+1)

View File

@ -2795,6 +2795,9 @@ class GrampsParser(UpdateCallback):
set_date(self.event, tag) set_date(self.event, tag)
def stop_first(self, tag): def stop_first(self, tag):
# bug 9242
if len(tag.splitlines()) != 1:
tag = "".join(tag.splitlines())
self.name.set_first_name(tag) self.name.set_first_name(tag)
def stop_call(self, tag): def stop_call(self, tag):