From 3dc979138248454bdfba3a56d43780703b8894c7 Mon Sep 17 00:00:00 2001 From: cahrens Date: Tue, 21 May 2013 09:38:56 -0400 Subject: [PATCH] Update xblock, start Selenium. --- common/lib/xmodule/xmodule/combined_open_ended_module.py | 9 +++------ common/lib/xmodule/xmodule/peer_grading_module.py | 5 ++--- common/lib/xmodule/xmodule/tests/test_xml_module.py | 3 +-- common/lib/xmodule/xmodule/x_module.py | 2 ++ 4 files changed, 8 insertions(+), 11 deletions(-) diff --git a/common/lib/xmodule/xmodule/combined_open_ended_module.py b/common/lib/xmodule/xmodule/combined_open_ended_module.py index 5ecf84df9e..1a4fc2e7b0 100644 --- a/common/lib/xmodule/xmodule/combined_open_ended_module.py +++ b/common/lib/xmodule/xmodule/combined_open_ended_module.py @@ -59,16 +59,13 @@ class CombinedOpenEndedFields(object): attempts = StringyInteger(display_name="Maximum Attempts", help="The number of times the student can try to answer this problem.", default=1, scope=Scope.settings, values = {"min" : 1 }) - # TODO: move values to Boolean in xblock. - is_graded = Boolean(display_name="Graded", help="Whether or not the problem is graded.", default=False, scope=Scope.settings, - values=[{'display_name': "True", "value": True}, {'display_name': "False", "value": False}]) + is_graded = Boolean(display_name="Graded", help="Whether or not the problem is graded.", default=False, scope=Scope.settings) accept_file_upload = Boolean(display_name="Allow File Uploads", - help="Whether or not the student can submit files as a response.", default=False, scope=Scope.settings, - values=[{'display_name': "True", "value": True}, {'display_name': "False", "value": False}]) + help="Whether or not the student can submit files as a response.", default=False, scope=Scope.settings) skip_spelling_checks = Boolean(display_name="Disable Quality Filter", # TODO: passing of text failed with "won't". Need to make our code more robust. help="If False, submissions with poor spelling, short length, or poor grammar will not be peer reviewed.", - default=False, scope=Scope.settings, values=[{'display_name': "True", "value": True}, {'display_name': "False", "value": False}]) + default=False, scope=Scope.settings) due = Date(help="Date that this problem is due by", default=None, scope=Scope.settings) graceperiod = String(help="Amount of time after the due date that submissions will be accepted", default=None, scope=Scope.settings) diff --git a/common/lib/xmodule/xmodule/peer_grading_module.py b/common/lib/xmodule/xmodule/peer_grading_module.py index 98f0e33486..33249c1fb9 100644 --- a/common/lib/xmodule/xmodule/peer_grading_module.py +++ b/common/lib/xmodule/xmodule/peer_grading_module.py @@ -31,15 +31,14 @@ class PeerGradingFields(object): use_for_single_location = StringyBoolean(display_name="Show Single Problem", help='When True, only the single problem specified by "Link to Problem Location" is shown. ' 'When False, a panel is displayed with all problems available for peer grading.', - values=[{'display_name': "True", "value": True}, {'display_name': "False", "value": False}], default=USE_FOR_SINGLE_LOCATION, scope=Scope.settings) link_to_location = String(display_name="Link to Problem Location", help='The location of the problem being graded. Only used when "Show Single Problem" is True.', default=LINK_TO_LOCATION, scope=Scope.settings) # TODO: move boolean default into xfields is_graded = StringyBoolean(display_name="Graded", - help='Whether the student gets credit for grading this problem. Only used when "Show Single Problem" is True.', default=IS_GRADED, - values=[{'display_name': "True", "value": True}, {'display_name': "False", "value": False}], scope=Scope.settings) + help='Whether the student gets credit for grading this problem. Only used when "Show Single Problem" is True.', + default=IS_GRADED, scope=Scope.settings) due_date = Date(help="Due date that should be displayed.", default=None, scope=Scope.settings) grace_period_string = String(help="Amount of grace to give on the due date.", default=None, scope=Scope.settings) max_grade = StringyInteger(help="The maximum grade that a student can receive for this problem.", default=MAX_SCORE, diff --git a/common/lib/xmodule/xmodule/tests/test_xml_module.py b/common/lib/xmodule/xmodule/tests/test_xml_module.py index 341d0e591b..2278672564 100644 --- a/common/lib/xmodule/xmodule/tests/test_xml_module.py +++ b/common/lib/xmodule/xmodule/tests/test_xml_module.py @@ -32,8 +32,7 @@ class TestFields(object): # Used for testing float type float_non_select = StringyFloat(scope=Scope.settings, default=.999, values={'min': 0 , 'step' : .3}) # Used for testing that Booleans get mapped to select type - # TODO: move default value into xblock! - boolean_select = Boolean(scope=Scope.settings, values=[{'display_name': "True", "value": True}, {'display_name': "False", "value": False}]) + boolean_select = Boolean(scope=Scope.settings) class EditableMetadataFieldsTest(unittest.TestCase): diff --git a/common/lib/xmodule/xmodule/x_module.py b/common/lib/xmodule/xmodule/x_module.py index 69a3750526..d398f8fc2f 100644 --- a/common/lib/xmodule/xmodule/x_module.py +++ b/common/lib/xmodule/xmodule/x_module.py @@ -649,6 +649,8 @@ class XModuleDescriptor(XModuleFields, HTMLSnippet, ResourceTemplates, XBlock): # 3. A generic string editor for anything else (editing JSON representation of the value). type = "Generic" values = [] if field.values is None else copy.deepcopy(field.values) + if isinstance(values, tuple): + values = list(values) if isinstance(values, list): if len(values) > 0: type = "Select"