From 40399556c229fc0529a0056a1033af44b22aefa5 Mon Sep 17 00:00:00 2001 From: Serge Noiraud Date: Fri, 28 Aug 2009 16:25:30 +0000 Subject: [PATCH] NarrativeWeb : issue 2788 and 2914 : mixed / and \\ on windows svn: r13129 --- src/plugins/webreport/NarrativeWeb.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/plugins/webreport/NarrativeWeb.py b/src/plugins/webreport/NarrativeWeb.py index 900f40328..e2bce874f 100644 --- a/src/plugins/webreport/NarrativeWeb.py +++ b/src/plugins/webreport/NarrativeWeb.py @@ -524,6 +524,8 @@ class BasePage(object): of.write('\t
\n') # TODO. Check if build_url_fname can be used. newpath = '/'.join(['..']*3 + [newpath]) + if ( Utils.win ): + newpath = newpath.replace('\\','/') self.media_link(of, photo_handle, newpath, '', up=True) of.write('\t
\n\n') except (IOError, OSError), msg: @@ -570,6 +572,8 @@ class BasePage(object): descr = " ".join(wrapper.wrap(title)) # TODO. Check if build_url_fname can be used. newpath = '/'.join(['..']*3 + [newpath]) + if ( Utils.win ): + newpath = newpath.replace('\\','/') self.media_link(of, photo_handle, newpath, descr, up=True) except (IOError, OSError), msg: WarningDialog(_("Could not add photo to page"), str(msg)) @@ -1970,6 +1974,8 @@ class IndividualPage(BasePage): if mime_type: (photoUrl, thumbnailUrl) = self.report.prepare_copy_media(photo) thumbnailUrl = '/'.join(['..']*3 + [thumbnailUrl]) + if ( Utils.win ): + thumbnailUrl = thumbnailUrl.replace('\\','/') person_name = _nd.display(person) url = self.report.build_url_fname_html(person.handle, 'ppl', True) self.person_link(of, url, person_name, thumbnailUrl=thumbnailUrl) @@ -3149,6 +3155,8 @@ class NavWebReport(Report): of.write('\t\n') @@ -3186,7 +3194,10 @@ class NavWebReport(Report): subdirs.append(subdir) if up: subdirs = ['..']*3 + subdirs - return '/'.join(subdirs + [fname]) + nname = '/'.join(subdirs + [fname]) + if ( Utils.win ): + nname = nname.replace('\\','/') + return nname def build_url_fname_html(self, fname, subdir=None, up=False): return self.build_url_fname(fname, subdir, up) + self.ext @@ -3205,6 +3216,8 @@ class NavWebReport(Report): Imagine we run gramps on Windows (heaven forbits), we don't want to see backslashes in the URL. """ + if ( Utils.win ): + fname = fname.replace('\\','/') subdirs = self.build_subdirs(subdir, fname, up) return '/'.join(subdirs + [fname])