commit bb62e0e43cc970ef7b20d70276123336efae2868
parent 2eb1f32d8cee0a9ec45e5276cef0c3d0267cfb66
Author: Dan Callaghan <djc@djc.id.au>
Date: Fri, 28 Mar 2014 08:34:06 +1000
Genshi no longer defaults to UTF-8, need to explicitly tell it
Diffstat:
4 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/blog.py b/blog.py
@@ -74,19 +74,19 @@ def generate(dir, xslt, config):
for entry in entries:
rendered = template_loader.load('entry.html').generate(item=entry,
- config=config).render('xhtml')
+ config=config).render('xhtml', encoding='utf8')
transformed = str(xslt(lxml.etree.fromstring(rendered)))
constance.output(os.path.join(dir, entry.id.encode('utf8') + '.html'), transformed)
# index
rendered = template_loader.load('index.html').generate(items=entries,
- config=config).render('xhtml')
+ config=config).render('xhtml', encoding='utf8')
transformed = str(xslt(lxml.etree.fromstring(rendered)))
constance.output(os.path.join(dir, 'index.html'), transformed)
# feed
rendered = template_loader.load('index.atom').generate(items=entries,
- config=config).render('xml')
+ config=config).render('xml', encoding='utf8')
constance.output(os.path.join(dir, 'index.atom'), rendered)
return entries
diff --git a/homepage.py b/homepage.py
@@ -18,12 +18,12 @@ def generate(dir, xslt, blog_entries, reading_entries, config):
template = template_loader.load('index.html')
rendered = template.generate(blog_entries=blog_entries,
reading_entries=reading_entries,
- config=config).render('xhtml')
+ config=config).render('xhtml', encoding='utf8')
transformed = str(xslt(lxml.etree.fromstring(rendered), homepage='1'))
constance.output(os.path.join(dir, 'index.html'), transformed)
# firehose
rendered = template_loader.load('firehose.atom').generate(
items=chain(blog_entries, reading_entries),
- config=config).render('xml')
+ config=config).render('xml', encoding='utf8')
constance.output(os.path.join(dir, 'firehose.atom'), rendered)
diff --git a/reading.py b/reading.py
@@ -47,13 +47,13 @@ def generate(filename, xslt, config):
entries = ReadingLogEntrySet(filename)
rendered = template_loader.load('reading.html').generate(items=entries,
- config=config).render('xhtml')
+ config=config).render('xhtml', encoding='utf8')
transformed = str(xslt(lxml.etree.fromstring(rendered)))
constance.output(os.path.join(os.path.dirname(filename), 'reading.html'), transformed)
# feed
rendered = template_loader.load('reading.atom').generate(items=entries,
- config=config).render('xml')
+ config=config).render('xml', encoding='utf8')
constance.output(os.path.join(os.path.dirname(filename), 'reading.atom'), rendered)
return entries
diff --git a/tags.py b/tags.py
@@ -20,11 +20,11 @@ def generate(dir, xslt, blog_entries, config):
for tag in tag_freqs.keys():
tagged_entries = [e for e in blog_entries if tag in e.tags]
- rendered = template_loader.load('tag.html').generate(tag=tag, items=tagged_entries).render('xhtml')
+ rendered = template_loader.load('tag.html').generate(tag=tag, items=tagged_entries).render('xhtml', encoding='utf8')
transformed = str(xslt(lxml.etree.fromstring(rendered)))
constance.output(os.path.join(dir, tag.encode('utf8') + '.html'), transformed)
rendered = template_loader.load('index.html').generate(tag_freqs=tag_freqs,
- config=config).render('xhtml')
+ config=config).render('xhtml', encoding='utf8')
transformed = str(xslt(lxml.etree.fromstring(rendered)))
constance.output(os.path.join(dir, 'index.html'), transformed)