Commit 81e065bd by Calen Pennington

Fix more errors in tests

parent d61c91c1
......@@ -355,7 +355,11 @@ class CapaModule(XModule):
id=self.location.html_id(), ajax_url=self.system.ajax_url) + html + "</div>"
# now do the substitutions which are filesystem based, e.g. '/static/' prefixes
return self.system.replace_urls(html, self.descriptor.data_dir, course_namespace=self.location)
return self.system.replace_urls(
html,
getattr(self.descriptor, 'data_dir', ''),
course_namespace=self.location
)
def handle_ajax(self, dispatch, get):
'''
......@@ -462,10 +466,20 @@ class CapaModule(XModule):
for answer_id in answers:
try:
<<<<<<< HEAD
<<<<<<< HEAD
new_answer = {answer_id: self.system.replace_urls(answers[answer_id], self.metadata['data_dir'], course_namespace=self.location)}
=======
new_answer = {answer_id: self.system.replace_urls(answers[answer_id], self.descriptor.data_dir)}
>>>>>>> WIP: Save student state via StudentModule. Inheritance doesn't work
=======
new_answer = {
answer_id: self.system.replace_urls(
answers[answer_id],
getattr(self, 'data_dir', ''),
course_namespace=self.location
)
}
>>>>>>> Fix more errors in tests
except TypeError:
log.debug('Unable to perform URL substitution on answers[%s]: %s' % (answer_id, answers[answer_id]))
new_answer = {answer_id: answers[answer_id]}
......
......@@ -291,30 +291,6 @@ class CourseDescriptor(SequenceDescriptor):
return time.gmtime() > self.start
@property
def end(self):
return self._try_parse_time("end")
@end.setter
def end(self, value):
if isinstance(value, time.struct_time):
self.metadata['end'] = stringify_time(value)
@property
def enrollment_start(self):
return self._try_parse_time("enrollment_start")
@enrollment_start.setter
def enrollment_start(self, value):
if isinstance(value, time.struct_time):
self.metadata['enrollment_start'] = stringify_time(value)
@property
def enrollment_end(self):
return self._try_parse_time("enrollment_end")
@enrollment_end.setter
def enrollment_end(self, value):
if isinstance(value, time.struct_time):
self.metadata['enrollment_end'] = stringify_time(value)
@property
def grader(self):
return self._grading_policy['GRADER']
......@@ -326,7 +302,7 @@ class CourseDescriptor(SequenceDescriptor):
def raw_grader(self, value):
# NOTE WELL: this change will not update the processed graders. If we need that, this needs to call grader_from_conf
self._grading_policy['RAW_GRADER'] = value
self.definition['data'].setdefault('grading_policy',{})['GRADER'] = value
self.grading_policy['GRADER'] = value
@property
def grade_cutoffs(self):
......@@ -335,7 +311,7 @@ class CourseDescriptor(SequenceDescriptor):
@grade_cutoffs.setter
def grade_cutoffs(self, value):
self._grading_policy['GRADE_CUTOFFS'] = value
self.definition['data'].setdefault('grading_policy',{})['GRADE_CUTOFFS'] = value
self.grading_policy['GRADE_CUTOFFS'] = value
@lazyproperty
......
......@@ -44,6 +44,8 @@ class HtmlDescriptor(XmlDescriptor, EditingDescriptor):
filename_extension = "xml"
template_dir_name = "html"
data = String(help="Html contents to display for this module", scope=Scope.content)
js = {'coffee': [resource_string(__name__, 'js/src/html/edit.coffee')]}
js_module_name = "HTMLEditingDescriptor"
......
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