Commit 40f134ed by Calen Pennington

Don't use mutable defaults for fields

parent a39d607a
...@@ -121,7 +121,7 @@ class Textbook(object): ...@@ -121,7 +121,7 @@ class Textbook(object):
return table_of_contents return table_of_contents
class TextbookList(ModelType): class TextbookList(List):
def from_json(self, values): def from_json(self, values):
textbooks = [] textbooks = []
for title, book_url in values: for title, book_url in values:
...@@ -150,19 +150,19 @@ class TextbookList(ModelType): ...@@ -150,19 +150,19 @@ class TextbookList(ModelType):
class CourseDescriptor(SequenceDescriptor): class CourseDescriptor(SequenceDescriptor):
module_class = SequenceModule module_class = SequenceModule
textbooks = TextbookList(help="List of pairs of (title, url) for textbooks used in this course", default=[], scope=Scope.content) textbooks = TextbookList(help="List of pairs of (title, url) for textbooks used in this course", scope=Scope.content)
wiki_slug = String(help="Slug that points to the wiki for this course", scope=Scope.content) wiki_slug = String(help="Slug that points to the wiki for this course", scope=Scope.content)
enrollment_start = Date(help="Date that enrollment for this class is opened", scope=Scope.settings) enrollment_start = Date(help="Date that enrollment for this class is opened", scope=Scope.settings)
enrollment_end = Date(help="Date that enrollment for this class is closed", scope=Scope.settings) enrollment_end = Date(help="Date that enrollment for this class is closed", scope=Scope.settings)
start = Date(help="Start time when this module is visible", scope=Scope.settings) start = Date(help="Start time when this module is visible", scope=Scope.settings)
end = Date(help="Date that this class ends", scope=Scope.settings) end = Date(help="Date that this class ends", scope=Scope.settings)
advertised_start = StringOrDate(help="Date that this course is advertised to start", scope=Scope.settings) advertised_start = StringOrDate(help="Date that this course is advertised to start", scope=Scope.settings)
grading_policy = Object(help="Grading policy definition for this class", scope=Scope.content, default={}) grading_policy = Object(help="Grading policy definition for this class", scope=Scope.content)
show_calculator = Boolean(help="Whether to show the calculator in this course", default=False, scope=Scope.settings) show_calculator = Boolean(help="Whether to show the calculator in this course", default=False, scope=Scope.settings)
display_name = String(help="Display name for this module", scope=Scope.settings) display_name = String(help="Display name for this module", scope=Scope.settings)
tabs = List(help="List of tabs to enable in this course", scope=Scope.settings) tabs = List(help="List of tabs to enable in this course", scope=Scope.settings)
end_of_course_survey_url = String(help="Url for the end-of-course survey", scope=Scope.settings) end_of_course_survey_url = String(help="Url for the end-of-course survey", scope=Scope.settings)
discussion_blackouts = List(help="List of pairs of start/end dates for discussion blackouts", scope=Scope.settings, default=[]) 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,
...@@ -175,10 +175,10 @@ class CourseDescriptor(SequenceDescriptor): ...@@ -175,10 +175,10 @@ class CourseDescriptor(SequenceDescriptor):
no_grade = Boolean(help="True if this course isn't graded", default=False, scope=Scope.settings) no_grade = Boolean(help="True if this course isn't graded", default=False, scope=Scope.settings)
disable_progress_graph = Boolean(help="True if this course shouldn't display the progress graph", default=False, scope=Scope.settings) disable_progress_graph = Boolean(help="True if this course shouldn't display the progress graph", default=False, scope=Scope.settings)
pdf_textbooks = List(help="List of dictionaries containing pdf_textbook configuration", default=None, scope=Scope.settings) pdf_textbooks = List(help="List of dictionaries containing pdf_textbook configuration", default=None, scope=Scope.settings)
remote_gradebook = Object(scope=Scope.settings, default={}) remote_gradebook = Object(scope=Scope.settings)
allow_anonymous = Boolean(scope=Scope.settings, default=True) allow_anonymous = Boolean(scope=Scope.settings, default=True)
allow_anonymous_to_peers = Boolean(scope=Scope.settings, default=False) allow_anonymous_to_peers = Boolean(scope=Scope.settings, default=False)
advanced_modules = List(help="Beta modules used in your course", default=[], scope=Scope.settings) advanced_modules = List(help="Beta modules used in your course", scope=Scope.settings)
has_children = True has_children = True
info_sidebar_name = String(scope=Scope.settings, default='Course Handouts') info_sidebar_name = String(scope=Scope.settings, default='Course Handouts')
...@@ -256,27 +256,27 @@ class CourseDescriptor(SequenceDescriptor): ...@@ -256,27 +256,27 @@ class CourseDescriptor(SequenceDescriptor):
"min_count": 12, "min_count": 12,
"drop_count": 2, "drop_count": 2,
"short_label": "HW", "short_label": "HW",
"weight": 15 "weight": 0.15
}, },
{ {
"type": "Lab", "type": "Lab",
"min_count": 12, "min_count": 12,
"drop_count": 2, "drop_count": 2,
"weight": 15 "weight": 0.15
}, },
{ {
"type": "Midterm Exam", "type": "Midterm Exam",
"short_label": "Midterm", "short_label": "Midterm",
"min_count": 1, "min_count": 1,
"drop_count": 0, "drop_count": 0,
"weight": 30 "weight": 0.3
}, },
{ {
"type": "Final Exam", "type": "Final Exam",
"short_label": "Final", "short_label": "Final",
"min_count": 1, "min_count": 1,
"drop_count": 0, "drop_count": 0,
"weight": 40 "weight": 0.4
} }
], ],
"GRADE_CUTOFFS": { "GRADE_CUTOFFS": {
......
...@@ -6,4 +6,4 @@ ...@@ -6,4 +6,4 @@
# XBlock: # XBlock:
# Might change frequently, so put it in local-requirements.txt, # Might change frequently, so put it in local-requirements.txt,
# but conceptually is an external package, so it is in a separate repo. # but conceptually is an external package, so it is in a separate repo.
-e git+ssh://git@github.com/MITx/xmodule-debugger@857dcfe8#egg=XBlock -e git+ssh://git@github.com/MITx/xmodule-debugger@6d5c2443#egg=XBlock
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