Commit c36adf84 by Ned Batchelder

Minor cosmetic code fixes.

parent d7e44108
...@@ -555,7 +555,7 @@ class XModuleDescriptor(XModuleMixin, HTMLSnippet, ResourceTemplates, XBlock): ...@@ -555,7 +555,7 @@ class XModuleDescriptor(XModuleMixin, HTMLSnippet, ResourceTemplates, XBlock):
def from_xml(cls, xml_data, system, org=None, course=None): def from_xml(cls, xml_data, system, org=None, course=None):
""" """
Creates an instance of this descriptor from the supplied xml_data. Creates an instance of this descriptor from the supplied xml_data.
This may be overridden by subclasses This may be overridden by subclasses.
xml_data: A string of xml that will be translated into data and children xml_data: A string of xml that will be translated into data and children
for this module for this module
...@@ -565,13 +565,12 @@ class XModuleDescriptor(XModuleMixin, HTMLSnippet, ResourceTemplates, XBlock): ...@@ -565,13 +565,12 @@ class XModuleDescriptor(XModuleMixin, HTMLSnippet, ResourceTemplates, XBlock):
org and course are optional strings that will be used in the generated org and course are optional strings that will be used in the generated
module's url identifiers module's url identifiers
""" """
raise NotImplementedError( raise NotImplementedError('Modules must implement from_xml to be parsable from xml')
'Modules must implement from_xml to be parsable from xml')
def export_to_xml(self, resource_fs): def export_to_xml(self, resource_fs):
""" """
Returns an xml string representing this module, and all modules Returns an xml string representing this module, and all modules
underneath it. May also write required resources out to resource_fs underneath it. May also write required resources out to resource_fs.
Assumes that modules have single parentage (that no module appears twice Assumes that modules have single parentage (that no module appears twice
in the same course), and that it is thus safe to nest modules as xml in the same course), and that it is thus safe to nest modules as xml
...@@ -581,8 +580,7 @@ class XModuleDescriptor(XModuleMixin, HTMLSnippet, ResourceTemplates, XBlock): ...@@ -581,8 +580,7 @@ class XModuleDescriptor(XModuleMixin, HTMLSnippet, ResourceTemplates, XBlock):
XModuleDescriptor using the from_xml method with the same system, org, XModuleDescriptor using the from_xml method with the same system, org,
and course and course
""" """
raise NotImplementedError( raise NotImplementedError('Modules must implement export_to_xml to enable xml export')
'Modules must implement export_to_xml to enable xml export')
# =============================== BUILTIN METHODS ========================== # =============================== BUILTIN METHODS ==========================
def __eq__(self, other): def __eq__(self, other):
...@@ -756,8 +754,6 @@ class DescriptorSystem(Runtime): ...@@ -756,8 +754,6 @@ class DescriptorSystem(Runtime):
class XMLParsingSystem(DescriptorSystem): class XMLParsingSystem(DescriptorSystem):
def __init__(self, process_xml, policy, **kwargs): def __init__(self, process_xml, policy, **kwargs):
""" """
load_item, resources_fs, error_tracker: see DescriptorSystem
policy: a policy dictionary for overriding xml metadata policy: a policy dictionary for overriding xml metadata
process_xml: Takes an xml string, and returns a XModuleDescriptor process_xml: Takes an xml string, and returns a XModuleDescriptor
......
...@@ -217,8 +217,7 @@ class XmlDescriptor(XModuleDescriptor): ...@@ -217,8 +217,7 @@ class XmlDescriptor(XModuleDescriptor):
# give the class a chance to fix it up. The file will be written out # give the class a chance to fix it up. The file will be written out
# again in the correct format. This should go away once the CMS is # again in the correct format. This should go away once the CMS is
# online and has imported all current (fall 2012) courses from xml # online and has imported all current (fall 2012) courses from xml
if not system.resources_fs.exists(filepath) and hasattr( if not system.resources_fs.exists(filepath) and hasattr(cls, 'backcompat_paths'):
cls, 'backcompat_paths'):
candidates = cls.backcompat_paths(filepath) candidates = cls.backcompat_paths(filepath)
for candidate in candidates: for candidate in candidates:
if system.resources_fs.exists(candidate): if system.resources_fs.exists(candidate):
......
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