Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
e1502072
Commit
e1502072
authored
Nov 21, 2013
by
Don Mitchell
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1740 from edx/bug/locator_parse
Allow colons in Locator fields.
parents
d526027d
e8beb4d1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
1 deletions
+11
-1
common/lib/xmodule/xmodule/modulestore/parsers.py
+1
-1
common/lib/xmodule/xmodule/modulestore/tests/test_locators.py
+10
-0
No files found.
common/lib/xmodule/xmodule/modulestore/parsers.py
View file @
e1502072
...
@@ -7,7 +7,7 @@ BLOCK_PREFIX = r"block/"
...
@@ -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
# Prefix for the version portion of a locator URL, when it is preceded by a course ID
VERSION_PREFIX
=
r"version/"
VERSION_PREFIX
=
r"version/"
ALLOWED_ID_CHARS
=
r'[a-zA-Z0-9_\-~.]'
ALLOWED_ID_CHARS
=
r'[a-zA-Z0-9_\-~.
:
]'
URL_RE_SOURCE
=
r"""
URL_RE_SOURCE
=
r"""
(?P<tag>edx://)?
(?P<tag>edx://)?
...
...
common/lib/xmodule/xmodule/modulestore/tests/test_locators.py
View file @
e1502072
...
@@ -249,6 +249,16 @@ class LocatorTest(TestCase):
...
@@ -249,6 +249,16 @@ class LocatorTest(TestCase):
version_guid
=
ObjectId
(
test_id_loc
)
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
):
def
test_repr
(
self
):
testurn
=
'mit.eecs.6002x/'
+
BRANCH_PREFIX
+
'published/'
+
BLOCK_PREFIX
+
'HW3'
testurn
=
'mit.eecs.6002x/'
+
BRANCH_PREFIX
+
'published/'
+
BLOCK_PREFIX
+
'HW3'
testobj
=
BlockUsageLocator
(
course_id
=
testurn
)
testobj
=
BlockUsageLocator
(
course_id
=
testurn
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment