(configd) unicode issue in template generation

This commit is contained in:
Ad Schellevis 2016-02-10 08:42:45 +01:00
parent 5e2a99f61a
commit 1363689dc7
2 changed files with 3 additions and 1 deletions

View File

@ -1,4 +1,5 @@
#!/usr/local/bin/python2.7
# -*- coding: utf-8 -*-
"""
Copyright (c) 2014 Ad Schellevis

View File

@ -33,6 +33,7 @@ import os.path
import syslog
import collections
import copy
import codecs
import jinja2
import addons.template_helpers
@ -264,7 +265,7 @@ class Template(object):
# make sure the target directory exists
self._create_directory(filename)
f_out = open(filename, 'wb')
f_out = codecs.open(filename, 'wb', encoding="utf-8")
f_out.write(content)
# Check if the last character of our output contains an end-of-line, if not copy it in if
# it was in the original template.