When rendering templates, the locale was set to C in getpelican/pelican@ddcccfeaa9

If one used a locale that made use of unicode characters (like et_EE.UTF-8)
the files on disk would be in correct locale while links would be to C.

Works with Python3, gives ascii decoding errors with Python2
This commit is contained in:
Martin Paljak 2013-12-28 20:12:51 +00:00
commit 35c5ffb534

View file

@ -147,12 +147,7 @@ class Writer(object):
def _write_file(template, localcontext, output_path, name, override): def _write_file(template, localcontext, output_path, name, override):
"""Render the template write the file.""" """Render the template write the file."""
old_locale = locale.setlocale(locale.LC_ALL) output = template.render(localcontext)
locale.setlocale(locale.LC_ALL, str('C'))
try:
output = template.render(localcontext)
finally:
locale.setlocale(locale.LC_ALL, old_locale)
path = os.path.join(output_path, name) path = os.path.join(output_path, name)
try: try:
os.makedirs(os.path.dirname(path)) os.makedirs(os.path.dirname(path))