Commit 3ab17d75 by Don Mitchell Committed by Ned Batchelder

Allow colons in Locator fields.

parent fdf7ea2c
......@@ -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://)?
......
......@@ -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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment