diff --git a/src/plugins/NarrativeWeb.py b/src/plugins/NarrativeWeb.py
index 8bf5ead67..584334dc5 100644
--- a/src/plugins/NarrativeWeb.py
+++ b/src/plugins/NarrativeWeb.py
@@ -207,22 +207,19 @@ class BasePage:
This the base class to write certain HTML pages.
"""
- def __init__(self, title, options, archive, photo_list, gid):
+ def __init__(self, report, title, gid=None):
"""
+ report - instance of NavWebReport
title - text for the
tag
- options - dictionary with the options
- archive - an open tar archive (if not None) to write the file to
- photo_list - TODO describe
gid - Gramps ID
"""
+ self.report = report
self.title_str = title
self.gid = gid
- self.options = options
- self.archive = archive
+ self.src_list = {}
+
self.page_title = ""
- self.warn_dir = True
- self.cur_name = None # Internal use. The name of the output file, to be used for the tar archive.
self.author = get_researcher().get_name()
if self.author:
@@ -232,6 +229,7 @@ class BasePage:
# TODO. All of these attributes are not necessary, because we have
# also the options in self.options. Besides, we need to check which
# are still required.
+ options = report.options
self.inc_download = options['incdownload']
self.html_dir = options['target']
self.copyright = options['cright']
@@ -252,7 +250,6 @@ class BasePage:
self.use_gallery = options['gallery']
self.header = options['headernote']
self.footer = options['footernote']
- self.photo_list = photo_list
self.usegraph = options['graph']
self.graphgens = options['graphgens']
self.use_home = options['homenote'] != "" or \
@@ -262,11 +259,13 @@ class BasePage:
handle = photo.get_handle()
if store_ref:
lnk = (self.cur_fname, self.page_title, self.gid)
- if handle in self.photo_list:
- if lnk not in self.photo_list[handle]:
- self.photo_list[handle].append(lnk)
+ # FIXME. Is it OK to add to the photo_list of report?
+ photo_list = self.report.photo_list
+ if handle in photo_list:
+ if lnk not in photo_list[handle]:
+ photo_list[handle].append(lnk)
else:
- self.photo_list[handle] = [lnk]
+ photo_list[handle] = [lnk]
ext = os.path.splitext(photo.get_path())[1]
real_path = "%s/%s" % (self.build_path('images', handle), handle+ext)
@@ -275,7 +274,7 @@ class BasePage:
def create_file(self, name):
self.cur_fname = name + self.ext
- if self.archive:
+ if self.report.archive:
self.string_io = StringIO()
of = codecs.EncodedFile(self.string_io, 'utf-8',
self.encoding, 'xmlcharrefreplace')
@@ -311,7 +310,7 @@ class BasePage:
0/2/02c0d8f888f566ae95ffbdca64274b51
"""
self.cur_fname = self.link_path(path, name)
- if self.archive:
+ if self.report.archive:
self.string_io = StringIO()
of = codecs.EncodedFile(self.string_io, 'utf-8',
self.encoding, 'xmlcharrefreplace')
@@ -326,7 +325,7 @@ class BasePage:
return of
def close_file(self, of):
- if self.archive:
+ if self.report.archive:
tarinfo = tarfile.TarInfo(self.cur_fname)
tarinfo.size = len(self.string_io.getvalue())
tarinfo.mtime = time.time()
@@ -334,7 +333,7 @@ class BasePage:
tarinfo.uid = os.getuid()
tarinfo.gid = os.getgid()
self.string_io.seek(0)
- self.archive.addfile(tarinfo, self.string_io)
+ self.report.archive.addfile(tarinfo, self.string_io)
of.close()
else:
of.close()
@@ -344,11 +343,11 @@ class BasePage:
"""This creates an MD5 hex string to be used as filename."""
return md5.new(text).hexdigest()
- def display_footer(self, of, db):
+ def display_footer(self, of):
of.write('\n\n')
of.write('