mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
Fix for getpelican/pelican#1198
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:
parent
0b3dc9db21
commit
35c5ffb534
1 changed files with 1 additions and 6 deletions
|
|
@ -147,12 +147,7 @@ class Writer(object):
|
|||
|
||||
def _write_file(template, localcontext, output_path, name, override):
|
||||
"""Render the template write the file."""
|
||||
old_locale = locale.setlocale(locale.LC_ALL)
|
||||
locale.setlocale(locale.LC_ALL, str('C'))
|
||||
try:
|
||||
output = template.render(localcontext)
|
||||
finally:
|
||||
locale.setlocale(locale.LC_ALL, old_locale)
|
||||
output = template.render(localcontext)
|
||||
path = os.path.join(output_path, name)
|
||||
try:
|
||||
os.makedirs(os.path.dirname(path))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue