From 5b457e10bdea38ac636c2a836acc0a8596bf30ea Mon Sep 17 00:00:00 2001 From: Brian Matherly Date: Thu, 15 Feb 2007 03:14:03 +0000 Subject: [PATCH] * src/docgen/HtmlDoc.py: fix html template loading. * src/ReportBase/_ReportDialog.py: fix html template loading. svn: r8119 --- ChangeLog | 4 ++++ src/ReportBase/_ReportDialog.py | 4 ++-- src/docgen/HtmlDoc.py | 9 +++++---- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4cf80ec6d..15315dff6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2007-02-14 Brian Matherly + * src/docgen/HtmlDoc.py: fix html template loading. + * src/ReportBase/_ReportDialog.py: fix html template loading. + 2007-02-14 Douglas Blank * src/ReportBase/_ReportUtils.py: 0000922: Slight change to estimate_age, and an additional function diff --git a/src/ReportBase/_ReportDialog.py b/src/ReportBase/_ReportDialog.py index 5fa73ee19..62010092d 100644 --- a/src/ReportBase/_ReportDialog.py +++ b/src/ReportBase/_ReportDialog.py @@ -457,7 +457,7 @@ class ReportDialog(BareReportDialog): for template in tlist: if template != _user_template: self.template_combo.append_text(template) - if _template_map[template] == template_name: + if _template_map[template] == os.path.basename(template_name): active_index = template_index template_index = template_index + 1 self.template_combo.append_text(_user_template) @@ -608,7 +608,7 @@ class ReportDialog(BareReportDialog): if text == _user_template: self.template_name = self.html_fileentry.get_full_path(0) else: - self.template_name = "%s/%s" % (const.template_dir, + self.template_name = "%s%s%s" % (const.template_dir,os.path.sep, _template_map[text]) else: self.template_name = "" diff --git a/src/docgen/HtmlDoc.py b/src/docgen/HtmlDoc.py index 91e0cf764..4629c2bc2 100644 --- a/src/docgen/HtmlDoc.py +++ b/src/docgen/HtmlDoc.py @@ -130,9 +130,9 @@ class HtmlDoc(BaseDoc.BaseDoc): top_add = 1 bottom_add = 0 archive = tarfile.open(self.template) + self.map = {} for tarinfo in archive: self.map[tarinfo.name] = archive.extractfile(tarinfo) - archive.close() templateFile = self.map['template.html'] while 1: line = templateFile.readline() @@ -151,6 +151,7 @@ class HtmlDoc(BaseDoc.BaseDoc): else: self.bottom.append(line) templateFile.close() + archive.close if top_add == 1: mymsg = _("The marker '' was not in the template") @@ -345,7 +346,7 @@ class HtmlDoc(BaseDoc.BaseDoc): for name in self.map.keys(): if name == 'template.html': continue - fname = '%s/%s' % (self.base,name) + fname = '%s%s%s' % (self.base,os.path.sep,name) try: f = open(fname, 'wb') f.write(self.map[name].read()) @@ -362,7 +363,7 @@ class HtmlDoc(BaseDoc.BaseDoc): refname = "is%s" % os.path.basename(name) if self.image_dir: - imdir = "%s/%s" % (self.base,self.image_dir) + imdir = '%s%s%s' % (self.base,os.path.sep,self.image_dir) else: imdir = self.base @@ -374,7 +375,7 @@ class HtmlDoc(BaseDoc.BaseDoc): try: img = ImgManip.ImgManip(name) - img.jpg_thumbnail("%s/%s" % (imdir,refname),size,size) + img.jpg_thumbnail("%s%s%s" % (imdir,os.path.sep,refname),size,size) except: return