From 79c193f74b90825e09886e58c0fa90b5774412e2 Mon Sep 17 00:00:00 2001 From: romjerome Date: Mon, 7 Mar 2016 15:05:19 +0100 Subject: [PATCH] 9242: multiple lines on firstname can corrupt ODT file fix gramps XML file via import/export but do not know the cause --- gramps/plugins/export/exportxml.py | 7 ++++++- gramps/plugins/importer/importxml.py | 3 +++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/gramps/plugins/export/exportxml.py b/gramps/plugins/export/exportxml.py index 7afc2053b..9e8153e53 100644 --- a/gramps/plugins/export/exportxml.py +++ b/gramps/plugins/export/exportxml.py @@ -979,6 +979,11 @@ class GrampsXmlWriter(UpdateCallback): def dump_name(self, name,alternative=False,index=1): sp = " "*index 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\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) for surname in name.get_surname_list(): self.write_surname(surname,index+1) diff --git a/gramps/plugins/importer/importxml.py b/gramps/plugins/importer/importxml.py index 7857f036e..1a6307408 100644 --- a/gramps/plugins/importer/importxml.py +++ b/gramps/plugins/importer/importxml.py @@ -2795,6 +2795,9 @@ class GrampsParser(UpdateCallback): set_date(self.event, tag) def stop_first(self, tag): + # bug 9242 + if len(tag.splitlines()) != 1: + tag = "".join(tag.splitlines()) self.name.set_first_name(tag) def stop_call(self, tag):