From 61f6dabdcfddfe03d41936a15f6c27245d0a4fb0 Mon Sep 17 00:00:00 2001 From: jinder1s Date: Mon, 30 Sep 2019 11:01:31 -0400 Subject: [PATCH 1/2] correctly decoding bytes to utf-8 --- cms/djangoapps/contentstore/views/certificates.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cms/djangoapps/contentstore/views/certificates.py b/cms/djangoapps/contentstore/views/certificates.py index 69a208c8b9..607e463e06 100644 --- a/cms/djangoapps/contentstore/views/certificates.py +++ b/cms/djangoapps/contentstore/views/certificates.py @@ -237,6 +237,8 @@ class CertificateManager(object): Deserialize from a JSON representation into a Certificate object. 'value' should be either a Certificate instance, or a valid JSON string """ + if not six.PY2 and not isinstance(value, six.integer_types): + value = value.decode('utf-8') # Ensure the schema fieldset meets our expectations for key in ("name", "description", "version"): From c05d469a620c080c0206f3f8cbb621ba3ec26a3b Mon Sep 17 00:00:00 2001 From: jinder1s Date: Mon, 30 Sep 2019 11:12:36 -0400 Subject: [PATCH 2/2] Fixing conditional --- cms/djangoapps/contentstore/views/certificates.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cms/djangoapps/contentstore/views/certificates.py b/cms/djangoapps/contentstore/views/certificates.py index 607e463e06..626524bfe1 100644 --- a/cms/djangoapps/contentstore/views/certificates.py +++ b/cms/djangoapps/contentstore/views/certificates.py @@ -237,7 +237,7 @@ class CertificateManager(object): Deserialize from a JSON representation into a Certificate object. 'value' should be either a Certificate instance, or a valid JSON string """ - if not six.PY2 and not isinstance(value, six.integer_types): + if not six.PY2 and isinstance(value, bytes): value = value.decode('utf-8') # Ensure the schema fieldset meets our expectations