diff --git a/common/lib/xmodule/xmodule/error_module.py b/common/lib/xmodule/xmodule/error_module.py index 40b008b5e2..1391dc4ac2 100644 --- a/common/lib/xmodule/xmodule/error_module.py +++ b/common/lib/xmodule/xmodule/error_module.py @@ -99,7 +99,7 @@ class ErrorDescriptor(ErrorFields, XModuleDescriptor): # real metadata stays in the content, but add a display name field_data = DictFieldData({ - 'error_msg': str(error_msg), + 'error_msg': unicode(error_msg), 'contents': contents, 'location': location, 'category': 'error' diff --git a/common/lib/xmodule/xmodule/modulestore/split_mongo/mongo_connection.py b/common/lib/xmodule/xmodule/modulestore/split_mongo/mongo_connection.py index f30b82a3d3..9109d31be5 100644 --- a/common/lib/xmodule/xmodule/modulestore/split_mongo/mongo_connection.py +++ b/common/lib/xmodule/xmodule/modulestore/split_mongo/mongo_connection.py @@ -80,7 +80,7 @@ class MongoConnection(object): """ Get the course_index from the persistence mechanism whose id is the given key """ - case_regex = r"(?i)^{}$" if ignore_case else r"{}" + case_regex = ur"(?i)^{}$" if ignore_case else ur"{}" return self.course_index.find_one( son.SON([ (key_attr, re.compile(case_regex.format(getattr(key, key_attr)))) diff --git a/common/lib/xmodule/xmodule/tests/test_import.py b/common/lib/xmodule/xmodule/tests/test_import.py index 0291672f39..159925e72b 100644 --- a/common/lib/xmodule/xmodule/tests/test_import.py +++ b/common/lib/xmodule/xmodule/tests/test_import.py @@ -438,7 +438,7 @@ class ImportTestCase(BaseCourseTestCase): print("course errors:") # Expect to find an error/exception about characters in "®esources" - expect = "UnicodeEncodeError" + expect = "InvalidKeyError" errors = [ (msg.encode("utf-8"), err.encode("utf-8")) for msg, err diff --git a/common/lib/xmodule/xmodule/x_module.py b/common/lib/xmodule/xmodule/x_module.py index 6341b443e5..3ce77b7b2f 100644 --- a/common/lib/xmodule/xmodule/x_module.py +++ b/common/lib/xmodule/xmodule/x_module.py @@ -605,7 +605,7 @@ def policy_key(location): Get the key for a location in a policy file. (Since the policy file is specific to a course, it doesn't need the full location url). """ - return '{cat}/{name}'.format(cat=location.category, name=location.name) + return u'{cat}/{name}'.format(cat=location.category, name=location.name) Template = namedtuple("Template", "metadata data children")