[FIX] runbot_cla: fix enforce utf-8 even when runbot locale is different

The CLA md file must be encoded in UTF-8 but before this commit, the
file was opened with the locale of the system running the runbot. That
way, a UnicodeDecodeError was raised when the CLA was UTF-8 and not the
runbot locale was different. Leading to wrong validations.

This commit enforce UTF-8 encoding when opening the CLA's.
This commit is contained in:
Christophe Monniez 2018-03-14 11:07:55 +01:00
parent 9ff0e171e0
commit f5dcb7b371

View File

@ -1,6 +1,7 @@
# -*- encoding: utf-8 -*-
import glob
import io
import logging
import re
@ -24,7 +25,7 @@ class runbot_build(models.Model):
state = "success"
else:
try:
cla = ''.join(open(f).read() for f in cla_glob)
cla = ''.join(io.open(f,encoding='utf-8').read() for f in cla_glob)
if cla.lower().find(email) != -1:
state = "success"
except UnicodeDecodeError: