diff --git a/common/lib/xmodule/xmodule/modulestore/parsers.py b/common/lib/xmodule/xmodule/modulestore/parsers.py index 64d3c25a510268ce15c650943a80933e8bf29d00..dbef47d61016c4f101ceef226127a5dd1eb93bda 100644 --- a/common/lib/xmodule/xmodule/modulestore/parsers.py +++ b/common/lib/xmodule/xmodule/modulestore/parsers.py @@ -7,7 +7,7 @@ BLOCK_PREFIX = r"block/" # Prefix for the version portion of a locator URL, when it is preceded by a course ID VERSION_PREFIX = r"version/" -ALLOWED_ID_CHARS = r'[a-zA-Z0-9_\-~.]' +ALLOWED_ID_CHARS = r'[a-zA-Z0-9_\-~.:]' URL_RE_SOURCE = r""" (?P<tag>edx://)? diff --git a/common/lib/xmodule/xmodule/modulestore/tests/test_locators.py b/common/lib/xmodule/xmodule/modulestore/tests/test_locators.py index c6c21c15404789827090fd7a1791b328155a1921..e9fc4ecf73b2724582ac332c948b0d162fc8a847 100644 --- a/common/lib/xmodule/xmodule/modulestore/tests/test_locators.py +++ b/common/lib/xmodule/xmodule/modulestore/tests/test_locators.py @@ -249,6 +249,16 @@ class LocatorTest(TestCase): version_guid=ObjectId(test_id_loc) ) + def test_colon_name(self): + """ + It seems we used to use colons in names; so, ensure they're acceptable. + """ + course_id = 'mit.eecs-1' + branch = 'foo' + usage_id = 'problem:with-colon~2' + testobj = BlockUsageLocator(course_id=course_id, branch=branch, usage_id=usage_id) + self.check_block_locn_fields(testobj, 'Cannot handle colon', course_id=course_id, branch=branch, block=usage_id) + def test_repr(self): testurn = 'mit.eecs.6002x/' + BRANCH_PREFIX + 'published/' + BLOCK_PREFIX + 'HW3' testobj = BlockUsageLocator(course_id=testurn)