Files
edx-platform/lms/djangoapps/staticbook/views.py
Victor Shnayder 2df3a6ef11 Big access control refactor
* All access control logic is now in access.py
* It exports a single method for general use: has_access(user, object, action)
 - possible actions depend on object type (e.g. 'see_exists', 'enroll', 'staff')
* Removed DARK_LAUNCH feature flag--it is now the default behavior
* Replaced check_course with three separate more focused functions that use has_access

Minor things:
* note on using pdb in testing
* moved time parsing helper into timeparse.py
* x_modules now have a .start attribute (None if not in metadata)
2012-08-14 23:30:37 -04:00

19 lines
791 B
Python

from django.contrib.auth.decorators import login_required
from mitxmako.shortcuts import render_to_response
from courseware.courses import get_course_with_access
from lxml import etree
@login_required
def index(request, course_id, page=0):
course = get_course_with_access(request.user, course_id, 'load')
raw_table_of_contents = open('lms/templates/book_toc.xml', 'r') # TODO: This will need to come from S3
table_of_contents = etree.parse(raw_table_of_contents).getroot()
return render_to_response('staticbook.html',
{'page': int(page), 'course': course,
'table_of_contents': table_of_contents})
def index_shifted(request, course_id, page):
return index(request, course_id=course_id, page=int(page) + 24)