Commit 5d9fad5a by Victor Shnayder

Minor cleanups before pull request

parent e4fb9ec6
...@@ -14,7 +14,7 @@ from xmodule.timeparse import parse_time ...@@ -14,7 +14,7 @@ from xmodule.timeparse import parse_time
from xmodule.x_module import XModule, XModuleDescriptor from xmodule.x_module import XModule, XModuleDescriptor
DEBUG_ACCESS = True DEBUG_ACCESS = False
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
......
...@@ -143,15 +143,12 @@ def get_module(user, request, location, student_module_cache, position=None): ...@@ -143,15 +143,12 @@ def get_module(user, request, location, student_module_cache, position=None):
Returns: xmodule instance Returns: xmodule instance
''' '''
# has_access below needs an actual Location
location = Location(location)
descriptor = modulestore().get_item(location) descriptor = modulestore().get_item(location)
# Short circuit--if the user shouldn't have access, bail without doing any work # Short circuit--if the user shouldn't have access, bail without doing any work
if not has_access(user, descriptor, 'load'): if not has_access(user, descriptor, 'load'):
return None return None
#TODO Only check the cache if this module can possibly have state #TODO Only check the cache if this module can possibly have state
instance_module = None instance_module = None
shared_module = None shared_module = None
...@@ -165,22 +162,16 @@ def get_module(user, request, location, student_module_cache, position=None): ...@@ -165,22 +162,16 @@ def get_module(user, request, location, student_module_cache, position=None):
shared_module = student_module_cache.lookup(descriptor.category, shared_module = student_module_cache.lookup(descriptor.category,
shared_state_key) shared_state_key)
instance_state = instance_module.state if instance_module is not None else None instance_state = instance_module.state if instance_module is not None else None
shared_state = shared_module.state if shared_module is not None else None shared_state = shared_module.state if shared_module is not None else None
# TODO (vshnayder): fix hardcoded urls (use reverse)
# Setup system context for module instance # Setup system context for module instance
ajax_url = reverse('modx_dispatch', ajax_url = reverse('modx_dispatch',
kwargs=dict(course_id=descriptor.location.course_id, kwargs=dict(course_id=descriptor.location.course_id,
id=descriptor.location.url(), id=descriptor.location.url(),
dispatch=''), dispatch=''),
) )
# ajax_url = settings.MITX_ROOT_URL + '/modx/' + descriptor.location.url() + '/'
# Fully qualified callback URL for external queueing system # Fully qualified callback URL for external queueing system
xqueue_callback_url = request.build_absolute_uri('/')[:-1] # Trailing slash provided by reverse xqueue_callback_url = request.build_absolute_uri('/')[:-1] # Trailing slash provided by reverse
xqueue_callback_url += reverse('xqueue_callback', xqueue_callback_url += reverse('xqueue_callback',
...@@ -225,7 +216,7 @@ def get_module(user, request, location, student_module_cache, position=None): ...@@ -225,7 +216,7 @@ def get_module(user, request, location, student_module_cache, position=None):
) )
# pass position specified in URL to module through ModuleSystem # pass position specified in URL to module through ModuleSystem
system.set('position', position) system.set('position', position)
system.set('DEBUG',settings.DEBUG) system.set('DEBUG', settings.DEBUG)
module = descriptor.xmodule_constructor(system)(instance_state, shared_state) module = descriptor.xmodule_constructor(system)(instance_state, shared_state)
......
...@@ -333,8 +333,6 @@ def grade_summary(request, course_id): ...@@ -333,8 +333,6 @@ def grade_summary(request, course_id):
def instructor_dashboard(request, course_id): def instructor_dashboard(request, course_id):
"""Display the instructor dashboard for a course.""" """Display the instructor dashboard for a course."""
course = get_course_with_access(request.user, course_id, 'staff') course = get_course_with_access(request.user, course_id, 'staff')
if not has_access(request.user, course, 'staff'):
raise Http404
# For now, just a static page # For now, just a static page
context = {'course': course } context = {'course': course }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment