Commit 944c4336 by Sarina Canelake

Merge branch 'release'

parents e3cef4e2 6aa5d2cc
......@@ -4,6 +4,7 @@ some xmodules by conditions.
import json
import logging
from lazy import lazy
from lxml import etree
from pkg_resources import resource_string
......@@ -97,10 +98,12 @@ class ConditionalModule(ConditionalFields, XModule):
return xml_value, attr_name
raise Exception('Error in conditional module: unknown condition "%s"' % xml_attr)
def is_condition_satisfied(self):
self.required_modules = [self.system.get_module(descriptor) for
descriptor in self.descriptor.get_required_module_descriptors()]
@lazy
def required_modules(self):
return [self.system.get_module(descriptor) for
descriptor in self.descriptor.get_required_module_descriptors()]
def is_condition_satisfied(self):
xml_value, attr_name = self._get_condition()
if xml_value and self.required_modules:
......
......@@ -181,7 +181,7 @@ class LTIModule(LTIFields, XModule):
]
# Obtains client_key and client_secret credentials from current course:
course_id = self.runtime.course_id
course_id = self.course_id
course_location = CourseDescriptor.id_to_location(course_id)
course = self.descriptor.runtime.modulestore.get_item(course_location)
client_key = client_secret = ''
......
......@@ -519,7 +519,7 @@ class PeerGradingModule(PeerGradingFields, XModule):
error_text = ""
problem_list = []
try:
problem_list_json = self.peer_gs.get_problem_list(self.system.course_id, self.system.anonymous_student_id)
problem_list_json = self.peer_gs.get_problem_list(self.course_id, self.system.anonymous_student_id)
problem_list_dict = problem_list_json
success = problem_list_dict['success']
if 'error' in problem_list_dict:
......@@ -569,7 +569,7 @@ class PeerGradingModule(PeerGradingFields, XModule):
ajax_url = self.ajax_url
html = self.system.render_template('peer_grading/peer_grading.html', {
'course_id': self.system.course_id,
'course_id': self.course_id,
'ajax_url': ajax_url,
'success': success,
'problem_list': good_problem_list,
......@@ -603,7 +603,7 @@ class PeerGradingModule(PeerGradingFields, XModule):
html = self.system.render_template('peer_grading/peer_grading_problem.html', {
'view_html': '',
'problem_location': problem_location,
'course_id': self.system.course_id,
'course_id': self.course_id,
'ajax_url': ajax_url,
# Checked above
'staff_access': False,
......
......@@ -134,6 +134,10 @@ class XModuleMixin(XBlockMixin):
)
@property
def course_id(self):
return self.runtime.course_id
@property
def id(self):
return self.location.url()
......@@ -743,6 +747,7 @@ class XModuleDescriptor(XModuleMixin, HTMLSnippet, ResourceTemplates, XBlock):
self.xmodule_runtime.xmodule_instance = descriptor._xmodule # pylint: disable=protected-access
return self.xmodule_runtime.xmodule_instance
course_id = module_attr('course_id')
displayable_items = module_attr('displayable_items')
get_display_items = module_attr('get_display_items')
get_icon_class = module_attr('get_icon_class')
......
<%
from django.core.urlresolvers import reverse
# course_id = module.location.course_id
def get_course_id(module):
return module.location.org +'/' + module.location.course +'/' + \
module.system.ajax_url.split('/')[4]
from django.core.urlresolvers import reverse
def _message(reqm, message):
return message.format(link="<a href={url}>{url_name}</a>".format(
url = reverse('jump_to', kwargs=dict(course_id=get_course_id(reqm),
url = reverse('jump_to', kwargs=dict(course_id=reqm.course_id,
location=reqm.location.url())),
url_name = reqm.display_name_with_default))
%>
......
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