Commit 0e4333d7 authored by Ad Schellevis's avatar Ad Schellevis Committed by Franco Fichtner

(configd) unicode issue in template generation

(cherry picked from commit 1363689d)
parent 49ad2356
#!/usr/local/bin/python2.7 #!/usr/local/bin/python2.7
# -*- coding: utf-8 -*-
""" """
Copyright (c) 2014 Ad Schellevis Copyright (c) 2014 Ad Schellevis
......
...@@ -36,6 +36,7 @@ import os.path ...@@ -36,6 +36,7 @@ import os.path
import syslog import syslog
import collections import collections
import copy import copy
import codecs
import jinja2 import jinja2
import addons.template_helpers import addons.template_helpers
...@@ -262,7 +263,7 @@ class Template(object): ...@@ -262,7 +263,7 @@ class Template(object):
# make sure the target directory exists # make sure the target directory exists
self._create_directory(filename) self._create_directory(filename)
f_out = open(filename, 'wb') f_out = codecs.open(filename, 'wb', encoding="utf-8")
f_out.write(content) f_out.write(content)
# Check if the last character of our output contains an end-of-line, if not copy it in if # 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. # it was in the original template.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment