Decided to codecs instead of messing with manual decode/encode
This commit is contained in:
parent
5537235adf
commit
0dd281bb31
|
@ -1,6 +1,7 @@
|
||||||
#!/usr/bin/env python2
|
#!/usr/bin/env python2
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
import codecs
|
||||||
|
|
||||||
from dateutil import parser
|
from dateutil import parser
|
||||||
|
|
||||||
|
@ -31,13 +32,13 @@ class TemplateMixin(object):
|
||||||
|
|
||||||
print "Rendering %s" % out_path
|
print "Rendering %s" % out_path
|
||||||
|
|
||||||
out_file = open(out_path, "wb")
|
out_file = codecs.open(out_path, 'wb', 'utf-8')
|
||||||
out_file.write(result.encode('utf-8'))
|
out_file.write(result)
|
||||||
out_file.close()
|
out_file.close()
|
||||||
|
|
||||||
|
|
||||||
def read_content_file(self, path):
|
def read_content_file(self, path):
|
||||||
content_file = open(path, 'r')
|
content_file = codecs.open(path, 'r', 'utf-8')
|
||||||
|
|
||||||
result = {}
|
result = {}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#!/usr/bin/env python2
|
#!/usr/bin/env python2
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
import codecs
|
||||||
from pylibsass import sass
|
from pylibsass import sass
|
||||||
|
|
||||||
from verdandi.mixins.messagemixin import MessageMixin
|
from verdandi.mixins.messagemixin import MessageMixin
|
||||||
|
@ -34,14 +35,14 @@ class SassAssets(MessageMixin, RenderMixin, AssetsMixin):
|
||||||
source_dir = os.path.dirname(source_path)
|
source_dir = os.path.dirname(source_path)
|
||||||
original_dir = os.getcwd()
|
original_dir = os.getcwd()
|
||||||
|
|
||||||
sass_file = open(source_path, 'r')
|
sass_file = codecs.open(source_path, 'r', 'utf-8')
|
||||||
css_file = open(dest_path, 'w')
|
css_file = codecs.open(dest_path, 'w', 'utf-8')
|
||||||
|
|
||||||
os.chdir(source_dir)
|
os.chdir(source_dir)
|
||||||
|
|
||||||
sass_string = sass_file.read().decode('utf-8')
|
sass_string = sass_file.read()
|
||||||
css_string = sass.compile_str(sass_string)
|
css_string = sass.compile_str(sass_string)
|
||||||
css_file.write(css_string.encode('utf-8'))
|
css_file.write(css_string)
|
||||||
|
|
||||||
os.chdir(original_dir)
|
os.chdir(original_dir)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue