From 504f049a1582599fce8f853d464ffabc14544127 Mon Sep 17 00:00:00 2001 From: Guido Günther Date: Fri, 30 Oct 2015 15:08:02 +0100 Subject: Encode to unicode to we work with genshi 0.7 --- htmlchangelog.py | 6 +++--- index.cgi | 11 ++++++----- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/htmlchangelog.py b/htmlchangelog.py index 426b994..432f251 100644 --- a/htmlchangelog.py +++ b/htmlchangelog.py @@ -48,8 +48,8 @@ class HTMLChangelog(debian.changelog.Changelog): strict=strict) self.templatedir = templatedir loader = TemplateLoader(self.templatedir) - self.html_tmpl = loader.load('cl.html') - self.block_tmpl = loader.load('block.html') + self.html_tmpl = loader.load('cl.html', encoding='utf-8') + self.block_tmpl = loader.load('block.html', encoding='utf-8') self.filter = HTMLChangelogFilter(vcsbrowser=vcsbrowser) def markup_block(self, block): @@ -60,5 +60,5 @@ class HTMLChangelog(debian.changelog.Changelog): return self.html_tmpl.generate(title=title, blocks=self._blocks, markup_block=self.markup_block) def __str__(self): - return self.stream().render('xhtml', doctype='xhtml-strict') + return self.stream().render('xhtml', doctype='xhtml-strict').encode('utf-8') diff --git a/index.cgi b/index.cgi index 68caf0d..a083166 100755 --- a/index.cgi +++ b/index.cgi @@ -1,7 +1,7 @@ #!/usr/bin/python -u # vim: set fileencoding=utf-8 : # -# (C) 2008 Guido Guenther +# (C) 2008,2015 Guido Guenther # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or @@ -28,7 +28,7 @@ from genshi.template import TemplateLoader import vcsbrowsers from htmlchangelog import HTMLChangelog -VERSION="0.0.3" +VERSION="0.0.4" XMLNS='http://www.w3.org/1999/xhtml' PTS='http://packages.qa.debian.org' PKGNAMERE="[a-zA-Z0-9.+\-]+$" @@ -82,9 +82,10 @@ def get_vcsbrowser(vcs, vcs_url): def render_search_page(title, pkg=None, err=None): loader = TemplateLoader('templates') - tmpl = loader.load('index.html') - print tmpl.generate(title=title, pkg=pkg, - err=err).render('xhtml', doctype='xhtml-strict') + tmpl = loader.load('index.html', encoding='utf-8') + t = tmpl.generate(title=title, pkg=pkg, err=err) + print t.render('xhtml', doctype='xhtml-strict').encode('utf-8') + def render_changelog_page(cl): -- cgit v1.2.3