Merge pull request #21921 from edx/BOM-805

BOM-805
This commit is contained in:
Ayub
2019-10-14 16:42:26 +05:00
committed by GitHub

View File

@@ -4,6 +4,7 @@ Utility functions for capa.
from __future__ import absolute_import
import re
import six
from cmath import isinf, isnan
from decimal import Decimal
@@ -117,7 +118,7 @@ def contextualize_text(text, context): # private
# Should be a separate dict of variables that should be
# replaced.
context_key = '$' + key
if context_key in text:
if context_key in (text.decode('utf-8') if six.PY3 and isinstance(text, bytes) else text):
text = convert_to_str(text)
context_value = convert_to_str(context[key])
text = text.replace(context_key, context_value)