Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
edx-platform-release
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Hsin-Yu Chien
edx-platform-release
Commits
9734347c
Commit
9734347c
authored
12 years ago
by
David Ormsbee
Browse files
Options
Downloads
Plain Diff
Merge pull request #556 from MITx/kimth/course-replace-in-infopage
Do URL replacement in course info page
parents
828430d6
115eebdb
Loading
Loading
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
lms/djangoapps/courseware/courses.py
+8
-2
8 additions, 2 deletions
lms/djangoapps/courseware/courses.py
lms/urls.py
+2
-0
2 additions, 0 deletions
lms/urls.py
with
10 additions
and
2 deletions
lms/djangoapps/courseware/courses.py
+
8
−
2
View file @
9734347c
...
...
@@ -5,6 +5,7 @@ import logging
from
path
import
path
from
django.conf
import
settings
from
django.core.urlresolvers
import
reverse
from
django.http
import
Http404
from
xmodule.course_module
import
CourseDescriptor
...
...
@@ -133,8 +134,13 @@ def get_course_info_section(course, section_key):
if
section_key
in
[
'
handouts
'
,
'
guest_handouts
'
,
'
updates
'
,
'
guest_updates
'
]:
try
:
with
course
.
system
.
resources_fs
.
open
(
path
(
"
info
"
)
/
section_key
+
"
.html
"
)
as
htmlFile
:
return
replace_urls
(
htmlFile
.
read
().
decode
(
'
utf-8
'
),
course
.
metadata
[
'
data_dir
'
])
# Replace '/static/' urls
info_html
=
replace_urls
(
htmlFile
.
read
().
decode
(
'
utf-8
'
),
course
.
metadata
[
'
data_dir
'
])
# Replace '/course/' urls
course_root
=
reverse
(
'
course_root
'
,
args
=
[
course
.
id
])[:
-
1
]
# Remove trailing slash
info_html
=
replace_urls
(
info_html
,
course_root
,
'
/course/
'
)
return
info_html
except
ResourceNotFoundError
:
log
.
exception
(
"
Missing info section {key} in course {url}
"
.
format
(
key
=
section_key
,
url
=
course
.
location
.
url
()))
...
...
This diff is collapsed.
Click to expand it.
lms/urls.py
+
2
−
0
View file @
9734347c
...
...
@@ -124,6 +124,8 @@ if settings.COURSEWARE_ENABLED:
'
courseware.views.course_about
'
,
name
=
"
about_course
"
),
#Inside the course
url
(
r
'
^courses/(?P<course_id>[^/]+/[^/]+/[^/]+)/$
'
,
'
courseware.views.course_info
'
,
name
=
"
course_root
"
),
url
(
r
'
^courses/(?P<course_id>[^/]+/[^/]+/[^/]+)/info$
'
,
'
courseware.views.course_info
'
,
name
=
"
info
"
),
url
(
r
'
^courses/(?P<course_id>[^/]+/[^/]+/[^/]+)/syllabus$
'
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment