diff --git a/common/lib/xmodule/xmodule/capa_module.py b/common/lib/xmodule/xmodule/capa_module.py index 36da929926..4728c713af 100644 --- a/common/lib/xmodule/xmodule/capa_module.py +++ b/common/lib/xmodule/xmodule/capa_module.py @@ -355,7 +355,11 @@ class CapaModule(XModule): id=self.location.html_id(), ajax_url=self.system.ajax_url) + html + "" # 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): ''' @@ -461,11 +465,21 @@ class CapaModule(XModule): new_answers = dict() 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]} diff --git a/common/lib/xmodule/xmodule/course_module.py b/common/lib/xmodule/xmodule/course_module.py index 510857303a..c11024e406 100644 --- a/common/lib/xmodule/xmodule/course_module.py +++ b/common/lib/xmodule/xmodule/course_module.py @@ -290,30 +290,6 @@ class CourseDescriptor(SequenceDescriptor): def has_started(self): 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 diff --git a/common/lib/xmodule/xmodule/html_module.py b/common/lib/xmodule/xmodule/html_module.py index 562eeeb361..6ec1061451 100644 --- a/common/lib/xmodule/xmodule/html_module.py +++ b/common/lib/xmodule/xmodule/html_module.py @@ -43,6 +43,8 @@ class HtmlDescriptor(XmlDescriptor, EditingDescriptor): module_class = HtmlModule 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"