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
6b0e992d
Commit
6b0e992d
authored
Aug 09, 2013
by
Chris Dodge
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
change regex names to better reflect what the actually match on
parent
d9d8d96e
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
5 deletions
+5
-5
common/lib/xmodule/xmodule/modulestore/store_utilities.py
+5
-5
No files found.
common/lib/xmodule/xmodule/modulestore/store_utilities.py
View file @
6b0e992d
...
...
@@ -7,7 +7,7 @@ from xmodule.modulestore.inheritance import own_metadata
import
logging
def
_
asset
_url_replace_regex
(
prefix
):
def
_
prefix_only
_url_replace_regex
(
prefix
):
"""
Match static urls in quotes that don't end in '?raw'.
...
...
@@ -23,7 +23,7 @@ def _asset_url_replace_regex(prefix):
"""
.
format
(
prefix
=
prefix
)
def
_
jump_to
_url_replace_regex
(
prefix
):
def
_
prefix_and_category
_url_replace_regex
(
prefix
):
"""
Match static urls in quotes that don't end in '?raw'.
...
...
@@ -75,7 +75,7 @@ def rewrite_nonportable_content_links(source_course_id, dest_course_id, text):
# the regex subsitution, log the error and continue
try
:
c4x_link_base
=
'{0}/'
.
format
(
StaticContent
.
get_base_url_path_for_course_assets
(
course_location
))
text
=
re
.
sub
(
_
asset
_url_replace_regex
(
c4x_link_base
),
portable_asset_link_subtitution
,
text
)
text
=
re
.
sub
(
_
prefix_only
_url_replace_regex
(
c4x_link_base
),
portable_asset_link_subtitution
,
text
)
except
Exception
,
e
:
logging
.
warning
(
"Error going regex subtituion (0) on text = {1}.
\n\n
Error msg = {2}"
.
format
(
c4x_link_base
,
text
,
str
(
e
)))
...
...
@@ -84,7 +84,7 @@ def rewrite_nonportable_content_links(source_course_id, dest_course_id, text):
try
:
jump_to_link_base
=
'/courses/{org}/{course}/{run}/jump_to/i4x://{org}/{course}/'
.
format
(
org
=
org
,
course
=
course
,
run
=
run
)
text
=
re
.
sub
(
_
jump_to
_url_replace_regex
(
jump_to_link_base
),
portable_jump_to_link_substitution
,
text
)
text
=
re
.
sub
(
_
prefix_and_category
_url_replace_regex
(
jump_to_link_base
),
portable_jump_to_link_substitution
,
text
)
except
Exception
,
e
:
logging
.
warning
(
"Error going regex subtituion (0) on text = {1}.
\n\n
Error msg = {2}"
.
format
(
jump_to_link_base
,
text
,
str
(
e
)))
...
...
@@ -100,7 +100,7 @@ def rewrite_nonportable_content_links(source_course_id, dest_course_id, text):
try
:
generic_courseware_link_base
=
'/courses/{org}/{course}/{run}/'
.
format
(
org
=
org
,
course
=
course
,
run
=
run
)
text
=
re
.
sub
(
_
asset
_url_replace_regex
(
generic_courseware_link_base
),
portable_asset_link_subtitution
,
text
)
text
=
re
.
sub
(
_
prefix_only
_url_replace_regex
(
generic_courseware_link_base
),
portable_asset_link_subtitution
,
text
)
except
Exception
,
e
:
logging
.
warning
(
"Error going regex subtituion (0) on text = {1}.
\n\n
Error msg = {2}"
.
format
(
generic_courseware_link_base
,
text
,
str
(
e
)))
...
...
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