Commit 32d67be5 by cahrens

Get rid of _computed_default.

parent 72584b59
...@@ -162,8 +162,7 @@ class CourseFields(object): ...@@ -162,8 +162,7 @@ class CourseFields(object):
discussion_blackouts = List(help="List of pairs of start/end dates for discussion blackouts", scope=Scope.settings) discussion_blackouts = List(help="List of pairs of start/end dates for discussion blackouts", scope=Scope.settings)
discussion_topics = Object( discussion_topics = Object(
help="Map of topics names to ids", help="Map of topics names to ids",
scope=Scope.settings, scope=Scope.settings
computed_default=lambda c: {'General': {'id': c.location.html_id()}},
) )
testcenter_info = Object(help="Dictionary of Test Center info", scope=Scope.settings) testcenter_info = Object(help="Dictionary of Test Center info", scope=Scope.settings)
announcement = Date(help="Date this course is announced", scope=Scope.settings) announcement = Date(help="Date this course is announced", scope=Scope.settings)
...@@ -234,6 +233,7 @@ class CourseDescriptor(CourseFields, SequenceDescriptor): ...@@ -234,6 +233,7 @@ class CourseDescriptor(CourseFields, SequenceDescriptor):
self._grading_policy = {} self._grading_policy = {}
self.set_grading_policy(self.grading_policy) self.set_grading_policy(self.grading_policy)
CourseFields.discussion_topics._default = {'General': {'id': self.location.html_id()}}
self.test_center_exams = [] self.test_center_exams = []
test_center_info = self.testcenter_info test_center_info = self.testcenter_info
......
...@@ -171,3 +171,7 @@ class IsNewCourseTestCase(unittest.TestCase): ...@@ -171,3 +171,7 @@ class IsNewCourseTestCase(unittest.TestCase):
d = self.get_dummy_course('2012-12-02T12:00', end='2014-9-04T12:00') d = self.get_dummy_course('2012-12-02T12:00', end='2014-9-04T12:00')
self.assertEqual('Sep 04, 2014', d.end_date_text) self.assertEqual('Sep 04, 2014', d.end_date_text)
def test_default_discussion_topics(self):
d = self.get_dummy_course('2012-12-02T12:00')
self.assertEqual({'General': {'id': 'i4x-test_org-test_course-course-test'}}, d.discussion_topics)
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