mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
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):
|
def _write_file(template, localcontext, output_path, name):
|
||||||
"""Render the template write the file."""
|
"""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))
|
filename = os.sep.join((output_path, name))
|
||||||
try:
|
try:
|
||||||
os.makedirs(os.path.dirname(filename))
|
os.makedirs(os.path.dirname(filename))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue