From 09bc188a1cbf083b7bd2a99cc8f27b653791a626 Mon Sep 17 00:00:00 2001 From: Paul Culley Date: Sun, 28 Jan 2018 21:29:43 -0600 Subject: [PATCH] Fix Book XML handler to deal with unusual characters in Book name Gramps42 (#536) * Fix Book XML handler to deal with unusual characters in Book name Fixes #10387 * Fix 'Generate Book' dialog for bad transient parent * Fix Book XML handler for unusual characters in report name Issue #10387 --- gramps/gen/plug/report/_book.py | 149 ++++++++++++--------- gramps/gui/plug/report/_bookdialog.py | 6 +- gramps/gui/plug/report/_docreportdialog.py | 7 +- 3 files changed, 91 insertions(+), 71 deletions(-) diff --git a/gramps/gen/plug/report/_book.py b/gramps/gen/plug/report/_book.py index 4af478680..1497f945a 100644 --- a/gramps/gen/plug/report/_book.py +++ b/gramps/gen/plug/report/_book.py @@ -457,79 +457,98 @@ class BookList(object): """ Saves the current BookList to the associated file. """ - f = open(self.file, "w") - f.write("\n") - f.write('\n') - for name in sorted(self.bookmap): # enable a diff of archived copies - book = self.get_book(name) - dbname = book.get_dbname() - f.write('\n' % (name, dbname) ) - for item in book.get_item_list(): - f.write(' \n' % - (item.get_name(),item.get_translated_name() ) ) - options = item.option_class.handler.options_dict - for option_name in sorted(options.keys()): # enable a diff - option_value = options[option_name] - if isinstance(option_value, (list, tuple)): - f.write(' \n') - else: - option_type = type_name(option_value) - value = escape(str(option_value)) - value = value.replace('"', '"') - f.write('