Merge pull request #19621 from cclauss/Fix-ur-strings-for-Python3

ur'strings' are syntax errors in Python 3
This commit is contained in:
Jeremy Bowman
2019-03-19 15:34:55 -04:00
committed by GitHub
5 changed files with 17 additions and 17 deletions

View File

@@ -12,9 +12,9 @@ def _prefix_only_url_replace_regex(pattern):
"""
Match urls in quotes pulling out the fields from pattern
"""
return re.compile(ur"""
return re.compile(u"""
(?x) # flags=re.VERBOSE
(?P<quote>\\?['"]) # the opening quotes
(?P<quote>\\\\?['"]) # the opening quotes
{}
(?P=quote) # the first matching closing quote
""".format(pattern))
@@ -53,7 +53,7 @@ def rewrite_nonportable_content_links(source_course_id, dest_course_id, text):
usage_block_pattern = unicode(source_course_id.make_usage_key(placeholder_category, placeholder_id))
usage_block_pattern = usage_block_pattern.replace(placeholder_category, r'(?P<category>[^/+@]+)')
usage_block_pattern = usage_block_pattern.replace(placeholder_id, r'(?P<block_id>.*?)')
jump_to_link_base = ur'/courses/{course_key_string}/jump_to/{usage_key_string}'.format(
jump_to_link_base = u'/courses/{course_key_string}/jump_to/{usage_key_string}'.format(
course_key_string=unicode(source_course_id), usage_key_string=usage_block_pattern
)
try: