forked from github/pelican
Switch to 'C' locale during page rendering.
Don't know why, but without it Jinja fails with UnicodeDecode error.
This commit is contained in:
parent
138e19fa19
commit
ddcccfeaa9
1 changed files with 6 additions and 1 deletions
|
|
@ -90,7 +90,12 @@ class Writer(object):
|
|||
|
||||
def _write_file(template, localcontext, output_path, name):
|
||||
"""Render the template write the file."""
|
||||
output = template.render(localcontext)
|
||||
old_locale = locale.setlocale(locale.LC_ALL)
|
||||
locale.setlocale(locale.LC_ALL, 'C')
|
||||
try:
|
||||
output = template.render(localcontext)
|
||||
finally:
|
||||
locale.setlocale(locale.LC_ALL, old_locale)
|
||||
filename = os.sep.join((output_path, name))
|
||||
try:
|
||||
os.makedirs(os.path.dirname(filename))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue