From 95a4e9ba3cb56658a28dde4b97bbc4964c81bb8d Mon Sep 17 00:00:00 2001 From: David Ormsbee Date: Mon, 19 Aug 2019 12:16:39 -0400 Subject: [PATCH] Fix BlockTransformer Py3 issues (#21376) Django's reverse can handle Unicode for arguments. --- cms/lib/xblock/runtime.py | 2 +- common/lib/xmodule/xmodule/modulestore/mongo/base.py | 2 +- lms/djangoapps/lms_xblock/runtime.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cms/lib/xblock/runtime.py b/cms/lib/xblock/runtime.py index 9b7f300632..016717fbe2 100644 --- a/cms/lib/xblock/runtime.py +++ b/cms/lib/xblock/runtime.py @@ -17,7 +17,7 @@ def handler_url(block, handler_name, suffix='', query='', thirdparty=False): raise NotImplementedError("edX Studio doesn't support third-party xblock handler urls") url = reverse('component_handler', kwargs={ - 'usage_key_string': six.text_type(block.scope_ids.usage_id).encode('utf-8'), + 'usage_key_string': six.text_type(block.scope_ids.usage_id), 'handler': handler_name, 'suffix': suffix, }).rstrip('/') diff --git a/common/lib/xmodule/xmodule/modulestore/mongo/base.py b/common/lib/xmodule/xmodule/modulestore/mongo/base.py index 26c6181b24..bd3c5b5264 100644 --- a/common/lib/xmodule/xmodule/modulestore/mongo/base.py +++ b/common/lib/xmodule/xmodule/modulestore/mongo/base.py @@ -859,7 +859,7 @@ class MongoModuleStore(ModuleStoreDraftAndPublished, ModuleStoreWriteBase, Mongo course_key = self.fill_in_run(course_key) parent_cache = self._get_parent_cache(self.get_branch_setting()) - while to_process and depth is None or depth >= 0: + while to_process and (depth is None or depth >= 0): children = [] for item in to_process: self._clean_item_data(item) diff --git a/lms/djangoapps/lms_xblock/runtime.py b/lms/djangoapps/lms_xblock/runtime.py index 483733073a..8b9d68e65c 100644 --- a/lms/djangoapps/lms_xblock/runtime.py +++ b/lms/djangoapps/lms_xblock/runtime.py @@ -51,7 +51,7 @@ def handler_url(block, handler_name, suffix='', query='', thirdparty=False): url = reverse(view_name, kwargs={ 'course_id': six.text_type(block.location.course_key), - 'usage_id': quote_slashes(six.text_type(block.scope_ids.usage_id).encode('utf-8')), + 'usage_id': quote_slashes(six.text_type(block.scope_ids.usage_id)), 'handler': handler_name, 'suffix': suffix, })