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
808c70ca
Commit
808c70ca
authored
Aug 15, 2012
by
kimth
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Quick workaround courses hierarchy
parent
49d36746
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
1 deletions
+17
-1
lms/djangoapps/courseware/views.py
+16
-1
lms/urls.py
+1
-0
No files found.
lms/djangoapps/courseware/views.py
View file @
808c70ca
import
json
import
logging
import
re
import
urllib
import
itertools
...
...
@@ -8,7 +9,7 @@ from django.core.context_processors import csrf
from
django.core.urlresolvers
import
reverse
from
django.contrib.auth.models
import
User
from
django.contrib.auth.decorators
import
login_required
from
django.http
import
Http404
,
HttpResponse
from
django.http
import
Http404
,
HttpResponse
,
HttpResponseRedirect
from
django.shortcuts
import
redirect
from
mitxmako.shortcuts
import
render_to_response
,
render_to_string
#from django.views.decorators.csrf import ensure_csrf_cookie
...
...
@@ -35,6 +36,20 @@ log = logging.getLogger("mitx.courseware")
template_imports
=
{
'urllib'
:
urllib
}
def
course_redirect
(
request
,
course_path
):
'''
Allows course XML to refer to its own directory structure without knowing the multicourse hierarchy.
Prepends the multicourse path to the requested course-internal path.
If the course_id cannot be determined, redirect to multicourse page. (NOTE: is Http404 more appropriate?)
'''
referer
=
request
.
META
[
'HTTP_REFERER'
]
match
=
re
.
search
(
r'/courses/(?P<course_id>[^/]+/[^/]+/[^/]+)/'
,
referer
)
courses_path
=
'/courses/'
if
match
is
not
None
:
courses_path
+=
match
.
group
(
'course_id'
)
+
'/'
+
course_path
return
HttpResponseRedirect
(
courses_path
)
def
user_groups
(
user
):
"""
TODO (vshnayder): This is not used. When we have a new plan for groups, adjust appropriately.
...
...
lms/urls.py
View file @
808c70ca
...
...
@@ -124,6 +124,7 @@ if settings.COURSEWARE_ENABLED:
'courseware.views.course_about'
,
name
=
"about_course"
),
#Inside the course
url
(
r'^course/(?P<course_path>.*)$'
,
'courseware.views.course_redirect'
),
url
(
r'^courses/(?P<course_id>[^/]+/[^/]+/[^/]+)/info$'
,
'courseware.views.course_info'
,
name
=
"info"
),
url
(
r'^courses/(?P<course_id>[^/]+/[^/]+/[^/]+)/book$'
,
...
...
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