Consider file encoding for modules in reconfigure

If the modules are not in utf8 then we warn and skip that file
like it happens for layout files.

It would be nice in both cases to have a warn in the gui and not only in the config.log
This commit is contained in:
José Matos 2020-08-15 17:49:23 +01:00
parent 5a212823d7
commit a8094051c1

View File

@ -1562,9 +1562,17 @@ def checkModulesConfig():
continue
seen.append(filename)
retval = processModuleFile(file, filename)
if retval:
tx.write(retval)
try:
retval = processModuleFile(file, filename)
if retval:
tx.write(retval)
except UnicodeDecodeError:
logger.warning("**************************************************\n"
"Module file '%s'\n"
"cannot be decoded in utf-8.\n"
"Please check if the file has the correct encoding.\n"
"Skipping this file!\n"
"**************************************************" % filename)
tx.close()
logger.info('\tdone')