diff --git a/gramps/gen/plug/report/_book.py b/gramps/gen/plug/report/_book.py index 53a5b050c..4ec1fd865 100644 --- a/gramps/gen/plug/report/_book.py +++ b/gramps/gen/plug/report/_book.py @@ -24,14 +24,15 @@ # Written by Alex Roitman, # largely based on the BaseDoc classes by Don Allingham +""" the non-UI-specific (i.e. common, shared) classes for books """ + #------------------------------------------------------------------------- # # Standard Python modules # #------------------------------------------------------------------------- -from ...const import GRAMPS_LOCALE as glocale -_ = glocale.translation.gettext import copy +import os #------------------------------------------------------------------------ # @@ -39,8 +40,7 @@ import copy # #------------------------------------------------------------------------ import logging -log = logging.getLogger(".Book") -import os +LOG = logging.getLogger(".Book") #------------------------------------------------------------------------- # @@ -55,6 +55,8 @@ from xml.sax.saxutils import escape # gramps modules # #------------------------------------------------------------------------- +from ...const import GRAMPS_LOCALE as glocale +_ = glocale.translation.gettext from ...const import HOME_DIR from ...utils.cast import get_type_converter_by_name, type_name from ..docgen import StyleSheet, StyleSheetList @@ -148,7 +150,7 @@ class BookItem: #------------------------------------------------------------------------ class Book: """ - Interface into the user-defined book -- a collection of book items. + Interface into the user-defined Book -- a collection of book items. """ def __init__(self, obj=None): @@ -454,79 +456,90 @@ class BookList: """ Saves the current BookList to the associated file. """ - with open(self.file, "w") as f: - f.write("\n") - f.write('\n') + with open(self.file, "w") as b_f: + b_f.write("\n") + b_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) ) + b_f.write(' \n' % (name, dbname)) for item in book.get_item_list(): - f.write(' \n' % - (item.get_name(), item.get_translated_name() ) ) + b_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') + b_f.write(' \n' % ( + list_index, + option_type, + value)) + b_f.write(' \n') else: option_type = type_name(option_value) value = escape(str(option_value)) value = value.replace('"', '"') - f.write('