Commit be103dfa by David Baumgold

improving code style

parent 4896444d
...@@ -711,20 +711,20 @@ class XModuleDescriptor(XModuleFields, HTMLSnippet, ResourceTemplates, XBlock): ...@@ -711,20 +711,20 @@ class XModuleDescriptor(XModuleFields, HTMLSnippet, ResourceTemplates, XBlock):
# =============================== BUILTIN METHODS ========================== # =============================== BUILTIN METHODS ==========================
def __eq__(self, other): def __eq__(self, other):
eq = (self.__class__ == other.__class__ and return (self.__class__ == other.__class__ and
all(getattr(self, attr, None) == getattr(other, attr, None) all(getattr(self, attr, None) == getattr(other, attr, None)
for attr in self.equality_attributes)) for attr in self.equality_attributes))
return eq
def __repr__(self): def __repr__(self):
return ("{class_}({system!r}, location={location!r}," return (
" model_data={model_data!r})".format( "{class_}({system!r}, location={location!r},"
class_=self.__class__.__name__, " model_data={model_data!r})".format(
system=self.system, class_=self.__class__.__name__,
location=self.location, system=self.system,
model_data=self._model_data, location=self.location,
)) model_data=self._model_data,
)
)
@property @property
def non_editable_metadata_fields(self): def non_editable_metadata_fields(self):
...@@ -785,15 +785,17 @@ class XModuleDescriptor(XModuleFields, HTMLSnippet, ResourceTemplates, XBlock): ...@@ -785,15 +785,17 @@ class XModuleDescriptor(XModuleFields, HTMLSnippet, ResourceTemplates, XBlock):
editor_type = "Float" editor_type = "Float"
elif isinstance(field, List): elif isinstance(field, List):
editor_type = "List" editor_type = "List"
metadata_fields[field.name] = {'field_name': field.name, metadata_fields[field.name] = {
'type': editor_type, 'field_name': field.name,
'display_name': field.display_name, 'type': editor_type,
'value': field.to_json(value), 'display_name': field.display_name,
'options': [] if values is None else values, 'value': field.to_json(value),
'default_value': field.to_json(default_value), 'options': [] if values is None else values,
'inheritable': inheritable, 'default_value': field.to_json(default_value),
'explicitly_set': explicitly_set, 'inheritable': inheritable,
'help': field.help} 'explicitly_set': explicitly_set,
'help': field.help,
}
return metadata_fields return metadata_fields
...@@ -885,28 +887,14 @@ class ModuleSystem(Runtime): ...@@ -885,28 +887,14 @@ class ModuleSystem(Runtime):
Note that these functions can be closures over e.g. a django request Note that these functions can be closures over e.g. a django request
and user, or other environment-specific info. and user, or other environment-specific info.
''' '''
def __init__(self, def __init__(
ajax_url, self, ajax_url, track_function, get_module, render_template,
track_function, replace_urls, xblock_model_data, user=None, filestore=None,
get_module, debug=False, xqueue=None, publish=None, node_path="",
render_template, anonymous_student_id='', course_id=None,
replace_urls, open_ended_grading_interface=None, s3_interface=None,
xblock_model_data, cache=None, can_execute_unsafe_code=None, replace_course_urls=None,
user=None, replace_jump_to_id_urls=None):
filestore=None,
debug=False,
xqueue=None,
publish=None,
node_path="",
anonymous_student_id='',
course_id=None,
open_ended_grading_interface=None,
s3_interface=None,
cache=None,
can_execute_unsafe_code=None,
replace_course_urls=None,
replace_jump_to_id_urls=None
):
''' '''
Create a closure around the system environment. Create a closure around the system environment.
......
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