Commit fee90f9b by Timothée Peignier

searching for find the real culprit, while releasing too fast

parent 57b17ba2
......@@ -36,13 +36,13 @@ class Compiler(object):
def read_file(self, path):
file = storage.open(path, 'rb')
content = file.read().decode('utf-8')
content = file.read()
file.close()
return content
def save_file(self, path, content):
file = storage.open(path, 'wb')
file.write(content.encode('utf-8'))
file.write(content)
file.close()
......@@ -58,7 +58,7 @@ class CompilerBase(object):
def save_file(self, path, content):
file = storage.open(path, 'wb')
file.write(content.encode('utf-8'))
file.write(content)
file.close()
return path
......@@ -71,10 +71,10 @@ class SubProcessCompiler(CompilerBase):
def execute_command(self, command, content):
pipe = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE,
stdin=subprocess.PIPE, stderr=subprocess.PIPE)
pipe.stdin.write(content.encode('utf-8'))
pipe.stdin.write(content)
pipe.stdin.close()
compressed_content = pipe.stdout.read().decode('utf-8')
compressed_content = pipe.stdout.read()
pipe.stdout.close()
error = pipe.stderr.read()
......
......@@ -13,7 +13,7 @@ class LessCompiler(CompilerBase):
def compile_file(self, content):
tmp_file = tempfile.NamedTemporaryFile(mode='w+b')
tmp_file.write(content.encode('utf-8'))
tmp_file.write(content)
tmp_file.flush()
output_file = tempfile.NamedTemporaryFile(mode='w+b')
......@@ -25,7 +25,7 @@ class LessCompiler(CompilerBase):
command_output = os.popen(command).read()
compiled_content = output_file.read().decode('utf-8')
compiled_content = output_file.read()
output_file.close()
tmp_file.close()
......
......@@ -197,7 +197,7 @@ class Compressor(object):
def read_file(self, path):
"""Read file content in binary mode"""
file = storage.open(path, 'rb')
content = file.read().decode('utf-8')
content = file.read()
file.close()
return content
......@@ -222,10 +222,10 @@ class SubProcessCompressor(CompressorBase):
def execute_command(self, command, content):
pipe = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE,
stdin=subprocess.PIPE, stderr=subprocess.PIPE)
pipe.stdin.write(content.encode('utf-8'))
pipe.stdin.write(content)
pipe.stdin.close()
compressed_content = pipe.stdout.read().decode('utf-8')
compressed_content = pipe.stdout.read()
pipe.stdout.close()
error = pipe.stderr.read()
......
......@@ -11,7 +11,7 @@ warnings.simplefilter('ignore', RuntimeWarning)
class CSSTidyCompressor(CompressorBase):
def compress_css(self, css):
tmp_file = tempfile.NamedTemporaryFile(mode='w+b')
tmp_file.write(css.encode('utf-8'))
tmp_file.write(css)
tmp_file.flush()
output_file = tempfile.NamedTemporaryFile(mode='w+b')
......@@ -23,7 +23,7 @@ class CSSTidyCompressor(CompressorBase):
command_output = os.popen(command).read()
filtered_css = output_file.read().decode('utf-8')
filtered_css = output_file.read()
output_file.close()
tmp_file.close()
......
......@@ -73,7 +73,7 @@ class Packager(object):
def save_file(self, path, content):
file = storage.open(path, 'wb')
file.write(content.encode('utf-8'))
file.write(content)
file.close()
return path
......@@ -90,7 +90,7 @@ class Packager(object):
for pattern in config[name]['source_filenames']:
for path in glob(pattern):
if not path in paths:
paths.append(path)
paths.append(str(path))
packages[name]['paths'] = [path for path in paths if not path.endswith(settings.PIPELINE_TEMPLATE_EXT)]
packages[name]['templates'] = [path for path in paths if path.endswith(settings.PIPELINE_TEMPLATE_EXT)]
packages[name]['output'] = config[name]['output_filename']
......
......@@ -29,7 +29,7 @@ class HashVersioningBase(VersioningBase):
def read_file(self, path):
"""Read file content in binary mode"""
file = storage.open(path, 'rb')
content = file.read().decode('utf-8')
content = file.read()
file.close()
return content
......
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