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
2199ae67
Commit
2199ae67
authored
Mar 11, 2013
by
Brian Wilson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add checks that book_index is in range
parent
fcb618f0
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
1 deletions
+7
-1
lms/djangoapps/staticbook/views.py
+7
-1
No files found.
lms/djangoapps/staticbook/views.py
View file @
2199ae67
from
lxml
import
etree
from
lxml
import
etree
# from django.conf import settings
from
django.contrib.auth.decorators
import
login_required
from
django.contrib.auth.decorators
import
login_required
from
django.http
import
Http404
from
mitxmako.shortcuts
import
render_to_response
from
mitxmako.shortcuts
import
render_to_response
from
courseware.access
import
has_access
from
courseware.access
import
has_access
...
@@ -15,6 +15,8 @@ def index(request, course_id, book_index, page=None):
...
@@ -15,6 +15,8 @@ def index(request, course_id, book_index, page=None):
staff_access
=
has_access
(
request
.
user
,
course
,
'staff'
)
staff_access
=
has_access
(
request
.
user
,
course
,
'staff'
)
book_index
=
int
(
book_index
)
book_index
=
int
(
book_index
)
if
book_index
<
0
or
book_index
>=
len
(
course
.
textbooks
):
raise
Http404
(
"Invalid book index value: {0}"
.
format
(
book_index
))
textbook
=
course
.
textbooks
[
book_index
]
textbook
=
course
.
textbooks
[
book_index
]
table_of_contents
=
textbook
.
table_of_contents
table_of_contents
=
textbook
.
table_of_contents
...
@@ -40,6 +42,8 @@ def pdf_index(request, course_id, book_index, chapter=None, page=None):
...
@@ -40,6 +42,8 @@ def pdf_index(request, course_id, book_index, chapter=None, page=None):
staff_access
=
has_access
(
request
.
user
,
course
,
'staff'
)
staff_access
=
has_access
(
request
.
user
,
course
,
'staff'
)
book_index
=
int
(
book_index
)
book_index
=
int
(
book_index
)
if
book_index
<
0
or
book_index
>=
len
(
course
.
pdf_textbooks
):
raise
Http404
(
"Invalid book index value: {0}"
.
format
(
book_index
))
textbook
=
course
.
pdf_textbooks
[
book_index
]
textbook
=
course
.
pdf_textbooks
[
book_index
]
def
remap_static_url
(
original_url
,
course
):
def
remap_static_url
(
original_url
,
course
):
...
@@ -74,6 +78,8 @@ def html_index(request, course_id, book_index, chapter=None, anchor_id=None):
...
@@ -74,6 +78,8 @@ def html_index(request, course_id, book_index, chapter=None, anchor_id=None):
staff_access
=
has_access
(
request
.
user
,
course
,
'staff'
)
staff_access
=
has_access
(
request
.
user
,
course
,
'staff'
)
book_index
=
int
(
book_index
)
book_index
=
int
(
book_index
)
if
book_index
<
0
or
book_index
>=
len
(
course
.
html_textbooks
):
raise
Http404
(
"Invalid book index value: {0}"
.
format
(
book_index
))
textbook
=
course
.
html_textbooks
[
book_index
]
textbook
=
course
.
html_textbooks
[
book_index
]
def
remap_static_url
(
original_url
,
course
):
def
remap_static_url
(
original_url
,
course
):
...
...
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