[FIX] web: missed P3 text model change

concat_xml was apparently missed during the Python 3 text model fixes,
resuling in a function which usually returns ``(bytes, str)`` but in
the case of an empty or missing ``file_list`` would return ``(str,
str))` instead, leading to type errors in Python 3.

Fix the particular case so it properly returns bytes as the
"concatenation result" even when it did nothing. Fix the docstring so
it properly reflects expectations as well.

closes odoo/odoo#34751

Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
This commit is contained in:
David Arnold
2019-07-30 06:41:09 +00:00
committed by Xavier Morel
parent 263e980817
commit a69b4653c5
+2 -2
View File
@@ -196,11 +196,11 @@ def concat_xml(file_list):
:param list(str) file_list: list of files to check
:returns: (concatenation_result, checksum)
:rtype: (str, str)
:rtype: (bytes, str)
"""
checksum = hashlib.new('sha1')
if not file_list:
return '', checksum.hexdigest()
return b'', checksum.hexdigest()
root = None
for fname in file_list: