From bdf8db05229f074dc747f444fefa57430ae7aeb8 Mon Sep 17 00:00:00 2001 From: Omar Al-Ithawi Date: Mon, 20 Oct 2014 15:15:11 +0300 Subject: [PATCH] Fixed UnicodeEncodeError in student`s migrations --- common/djangoapps/student/migrations/0035_access_roles.py | 6 +++--- .../student/migrations/0036_access_roles_orgless.py | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/common/djangoapps/student/migrations/0035_access_roles.py b/common/djangoapps/student/migrations/0035_access_roles.py index ede453ba1c..a29679bf4c 100644 --- a/common/djangoapps/student/migrations/0035_access_roles.py +++ b/common/djangoapps/student/migrations/0035_access_roles.py @@ -145,10 +145,10 @@ class Migration(DataMigration): if self.mongostore is not None: course_son = bson.son.SON([ ('_id.tag', 'i4x'), - ('_id.org', re.compile(r'^{}$'.format(downcased_ssck.org), re.IGNORECASE)), - ('_id.course', re.compile(r'^{}$'.format(downcased_ssck.course), re.IGNORECASE)), + ('_id.org', re.compile(ur'^{}$'.format(downcased_ssck.org), re.IGNORECASE | re.UNICODE)), + ('_id.course', re.compile(ur'^{}$'.format(downcased_ssck.course), re.IGNORECASE | re.UNICODE)), ('_id.category', 'course'), - ('_id.name', re.compile(r'^{}$'.format(downcased_ssck.run), re.IGNORECASE)), + ('_id.name', re.compile(ur'^{}$'.format(downcased_ssck.run), re.IGNORECASE | re.UNICODE)), ]) entry = self.mongostore.collection.find_one(course_son) if entry: diff --git a/common/djangoapps/student/migrations/0036_access_roles_orgless.py b/common/djangoapps/student/migrations/0036_access_roles_orgless.py index f57bdb5f2b..f3af6b4613 100644 --- a/common/djangoapps/student/migrations/0036_access_roles_orgless.py +++ b/common/djangoapps/student/migrations/0036_access_roles_orgless.py @@ -112,10 +112,10 @@ class Migration(DataMigration): if self.mongostore is not None: course_son = bson.son.SON([ ('_id.tag', 'i4x'), - ('_id.org', re.compile(r'^{}$'.format(downcased_ssck.org), re.IGNORECASE)), - ('_id.course', re.compile(r'^{}$'.format(downcased_ssck.course), re.IGNORECASE)), + ('_id.org', re.compile(ur'^{}$'.format(downcased_ssck.org), re.IGNORECASE | re.UNICODE)), + ('_id.course', re.compile(ur'^{}$'.format(downcased_ssck.course), re.IGNORECASE | re.UNICODE)), ('_id.category', 'course'), - ('_id.name', re.compile(r'^{}$'.format(downcased_ssck.run), re.IGNORECASE)), + ('_id.name', re.compile(ur'^{}$'.format(downcased_ssck.run), re.IGNORECASE | re.UNICODE)), ]) entry = self.mongostore.collection.find_one(course_son) if entry: