Fix the handling of modulemd files with unicode characters.

This commit introduces new to_text_type helper method and calls it
for return value of all mmd.dumps() calls. That way, we always
end up with proper unicode string represntation on both python
major versions.

This commit also adds unicode character to description of all
the yaml files we use in the tests so we can be sure MBS can
handle unicode characters properly.

This might be temporary fix, depending on the result of discussion
at https://github.com/fedora-modularity/libmodulemd/issues/184.
This commit is contained in:
Jan Kaluza
2019-02-12 15:57:22 +01:00
committed by mprahl
parent 7052ea0a11
commit 40f23b65e4
37 changed files with 122 additions and 97 deletions

View File

@@ -29,6 +29,7 @@ import tempfile
import os
from multiprocessing.dummy import Pool as ThreadPool
from datetime import datetime
from module_build_service.utils import to_text_type
import kobo.rpmlib
import requests
@@ -562,7 +563,7 @@ def submit_module_build(username, url, mmd, optional_params=None):
name=mmd.get_name(),
stream=mmd.get_stream(),
version=version_str,
modulemd=mmd.dumps(),
modulemd=to_text_type(mmd.dumps()),
scmurl=url,
username=username,
**(optional_params or {})
@@ -767,7 +768,7 @@ def load_local_builds(local_build_nsvs, session=None):
stream=mmd.get_stream(),
version=str(mmd.get_version()),
context=mmd.get_context(),
modulemd=mmd.dumps(),
modulemd=to_text_type(mmd.dumps()),
scmurl="",
username="mbs",
publish_msg=False)