Clean up some pre-existing formatting.
This commit is contained in:
committed by
Calen Pennington
parent
3faf7456b9
commit
b6bd293266
@@ -221,8 +221,7 @@ class ConditionalDescriptor(ConditionalFields, SequenceDescriptor):
|
||||
show_tag_list = []
|
||||
for child in xml_object:
|
||||
if child.tag == 'show':
|
||||
location = ConditionalDescriptor.parse_sources(
|
||||
child, system)
|
||||
location = ConditionalDescriptor.parse_sources(child, system)
|
||||
children.extend(location)
|
||||
show_tag_list.extend(location)
|
||||
else:
|
||||
|
||||
@@ -163,8 +163,8 @@ class Location(_LocationBase):
|
||||
def check_list(list_):
|
||||
def check(val, regexp):
|
||||
if val is not None and regexp.search(val) is not None:
|
||||
log.debug('invalid characters val="%s", list_="%s"' % (val, list_))
|
||||
raise InvalidLocationError("Invalid characters in '%s'." % (val))
|
||||
log.debug('invalid characters val=%r, list_=%r', val, list_)
|
||||
raise InvalidLocationError("Invalid characters in {!r}.".format(val))
|
||||
|
||||
list_ = list(list_)
|
||||
for val in list_[:4] + [list_[5]]:
|
||||
|
||||
@@ -7,20 +7,22 @@ from xblock.runtime import KeyValueStore
|
||||
|
||||
|
||||
class InheritanceMixin(XBlockMixin):
|
||||
"""Field definitions for inheritable fields"""
|
||||
"""Field definitions for inheritable fields."""
|
||||
|
||||
graded = Boolean(
|
||||
help="Whether this module contributes to the final course grade",
|
||||
scope=Scope.settings,
|
||||
default=False,
|
||||
scope=Scope.settings
|
||||
)
|
||||
|
||||
start = Date(
|
||||
help="Start time when this module is visible",
|
||||
default=datetime(2030, 1, 1, tzinfo=UTC),
|
||||
scope=Scope.settings
|
||||
)
|
||||
due = Date(help="Date that this problem is due by", scope=Scope.settings)
|
||||
due = Date(
|
||||
help="Date that this problem is due by",
|
||||
scope=Scope.settings,
|
||||
)
|
||||
extended_due = Date(
|
||||
help="Date that this problem is due by for a particular student. This "
|
||||
"can be set by an instructor, and will override the global due "
|
||||
@@ -29,31 +31,38 @@ class InheritanceMixin(XBlockMixin):
|
||||
default=None,
|
||||
scope=Scope.user_state,
|
||||
)
|
||||
giturl = String(help="url root for course data git repository", scope=Scope.settings)
|
||||
giturl = String(
|
||||
help="url root for course data git repository",
|
||||
scope=Scope.settings,
|
||||
)
|
||||
xqa_key = String(help="DO NOT USE", scope=Scope.settings)
|
||||
graceperiod = Timedelta(
|
||||
help="Amount of time after the due date that submissions will be accepted",
|
||||
scope=Scope.settings
|
||||
scope=Scope.settings,
|
||||
)
|
||||
showanswer = String(
|
||||
help="When to show the problem answer to the student",
|
||||
scope=Scope.settings,
|
||||
default="finished"
|
||||
default="finished",
|
||||
)
|
||||
rerandomize = String(
|
||||
help="When to rerandomize the problem",
|
||||
scope=Scope.settings,
|
||||
default="never",
|
||||
scope=Scope.settings
|
||||
)
|
||||
days_early_for_beta = Float(
|
||||
help="Number of days early to show content to beta users",
|
||||
scope=Scope.settings,
|
||||
default=None,
|
||||
scope=Scope.settings
|
||||
)
|
||||
static_asset_path = String(help="Path to use for static assets - overrides Studio c4x://", scope=Scope.settings, default='')
|
||||
static_asset_path = String(
|
||||
help="Path to use for static assets - overrides Studio c4x://",
|
||||
scope=Scope.settings,
|
||||
default='',
|
||||
)
|
||||
text_customization = Dict(
|
||||
help="String customization substitutions for particular locations",
|
||||
scope=Scope.settings
|
||||
scope=Scope.settings,
|
||||
)
|
||||
use_latex_compiler = Boolean(
|
||||
help="Enable LaTeX templates?",
|
||||
|
||||
@@ -485,7 +485,8 @@ class SplitMongoModuleStore(ModuleStoreWriteBase):
|
||||
}
|
||||
"""
|
||||
course = self._lookup_course(course_locator)['structure']
|
||||
return {'original_version': course['original_version'],
|
||||
return {
|
||||
'original_version': course['original_version'],
|
||||
'previous_version': course['previous_version'],
|
||||
'edited_by': course['edited_by'],
|
||||
'edited_on': course['edited_on']
|
||||
@@ -1328,8 +1329,7 @@ class SplitMongoModuleStore(ModuleStoreWriteBase):
|
||||
if depth is None or depth > 0:
|
||||
depth = depth - 1 if depth is not None else None
|
||||
for child in block_map[block_id]['fields'].get('children', []):
|
||||
descendent_map = self.descendants(block_map, child, depth,
|
||||
descendent_map)
|
||||
descendent_map = self.descendants(block_map, child, depth, descendent_map)
|
||||
|
||||
return descendent_map
|
||||
|
||||
|
||||
@@ -174,12 +174,17 @@ class ImportSystem(XMLParsingSystem, MakoDescriptorSystem):
|
||||
# Didn't load properly. Fall back on loading as an error
|
||||
# descriptor. This should never error due to formatting.
|
||||
|
||||
msg = "Error loading from xml. " + unicode(err)[:200]
|
||||
log.warning(msg)
|
||||
# Normally, we don't want lots of exception traces in our logs from common
|
||||
# content problems. But if you're debugging the xml loading code itself,
|
||||
# uncomment the next line.
|
||||
# log.exception(msg)
|
||||
msg = "Error loading from xml. %s"
|
||||
log.warning(
|
||||
msg,
|
||||
unicode(err)[:200],
|
||||
# Normally, we don't want lots of exception traces in our logs from common
|
||||
# content problems. But if you're debugging the xml loading code itself,
|
||||
# uncomment the next line.
|
||||
# exc_info=True
|
||||
)
|
||||
|
||||
msg = msg % (unicode(err)[:200])
|
||||
|
||||
self.error_tracker(msg)
|
||||
err_msg = msg + "\n" + exc_info_to_str(sys.exc_info())
|
||||
@@ -195,7 +200,7 @@ class ImportSystem(XMLParsingSystem, MakoDescriptorSystem):
|
||||
|
||||
xmlstore.modules[course_id][descriptor.location] = descriptor
|
||||
|
||||
if hasattr(descriptor, 'children'):
|
||||
if descriptor.has_children:
|
||||
for child in descriptor.get_children():
|
||||
parent_tracker.add_parent(child.location, descriptor.location)
|
||||
|
||||
@@ -368,7 +373,8 @@ class XMLModuleStore(ModuleStoreReadBase):
|
||||
String representation - for debugging
|
||||
'''
|
||||
return '<XMLModuleStore data_dir=%r, %d courses, %d modules>' % (
|
||||
self.data_dir, len(self.courses), len(self.modules))
|
||||
self.data_dir, len(self.courses), len(self.modules)
|
||||
)
|
||||
|
||||
def load_policy(self, policy_path, tracker):
|
||||
"""
|
||||
|
||||
@@ -660,8 +660,8 @@ class PeerGradingDescriptor(PeerGradingFields, RawDescriptor):
|
||||
metadata_translations = {
|
||||
'is_graded': 'graded',
|
||||
'attempts': 'max_attempts',
|
||||
'due_data' : 'due'
|
||||
}
|
||||
'due_data': 'due'
|
||||
}
|
||||
|
||||
@property
|
||||
def non_editable_metadata_fields(self):
|
||||
|
||||
@@ -119,13 +119,10 @@ class ImportTestCase(BaseCourseTestCase):
|
||||
tag_xml = descriptor.export_to_xml(resource_fs)
|
||||
re_import_descriptor = system.process_xml(tag_xml)
|
||||
|
||||
self.assertEqual(re_import_descriptor.__class__.__name__,
|
||||
'ErrorDescriptorWithMixins')
|
||||
self.assertEqual(re_import_descriptor.__class__.__name__, 'ErrorDescriptorWithMixins')
|
||||
|
||||
self.assertEqual(descriptor.contents,
|
||||
re_import_descriptor.contents)
|
||||
self.assertEqual(descriptor.error_msg,
|
||||
re_import_descriptor.error_msg)
|
||||
self.assertEqual(descriptor.contents, re_import_descriptor.contents)
|
||||
self.assertEqual(descriptor.error_msg, re_import_descriptor.error_msg)
|
||||
|
||||
def test_fixed_xml_tag(self):
|
||||
"""Make sure a tag that's been fixed exports as the original tag type"""
|
||||
|
||||
@@ -6,7 +6,7 @@ import sys
|
||||
from lxml import etree
|
||||
|
||||
from xblock.fields import Dict, Scope, ScopeIds
|
||||
from xmodule.x_module import (XModuleDescriptor, policy_key)
|
||||
from xmodule.x_module import XModuleDescriptor, policy_key
|
||||
from xmodule.modulestore import Location
|
||||
from xmodule.modulestore.inheritance import own_metadata, InheritanceKeyValueStore
|
||||
from xmodule.modulestore.xml_exporter import EdxJSONEncoder
|
||||
@@ -153,8 +153,7 @@ class XmlDescriptor(XModuleDescriptor):
|
||||
|
||||
xml_object: An etree Element
|
||||
"""
|
||||
raise NotImplementedError(
|
||||
"%s does not implement definition_from_xml" % cls.__name__)
|
||||
raise NotImplementedError("%s does not implement definition_from_xml" % cls.__name__)
|
||||
|
||||
@classmethod
|
||||
def clean_metadata_from_xml(cls, xml_object):
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<video name="S0V1: Video Resources" youtube_id_0_75="EuzkdzfR0i8" youtube_id_1_0="1bK-WdDi6Qw" youtube_id_1_25="0v1VzoDVUTM" youtube_id_1_5="Bxk_-ZJb240"/>
|
||||
</videosequence>
|
||||
<section name="Lecture 2">
|
||||
<sequential>
|
||||
<sequential>
|
||||
<video youtube_id_1_0="TBvX7HzxexQ"/>
|
||||
<problem name="L1 Problem 1" points="1" type="lecture" showanswer="attempted" filename="L1_Problem_1" rerandomize="never"/>
|
||||
</sequential>
|
||||
@@ -20,12 +20,11 @@
|
||||
</section>
|
||||
<video name="Lost Video" youtube_id_1_0="TBvX7HzxexQ"/>
|
||||
<sequential format="Lecture Sequence" url_name='test_sequence'>
|
||||
<vertical url_name='test_vertical'>
|
||||
<html url_name='test_html'>
|
||||
Foobar
|
||||
</html>
|
||||
</vertical>
|
||||
<vertical url_name='test_vertical'>
|
||||
<html url_name='test_html'>
|
||||
Foobar
|
||||
</html>
|
||||
</vertical>
|
||||
</sequential>
|
||||
</chapter>
|
||||
|
||||
</course>
|
||||
|
||||
@@ -110,7 +110,7 @@ def dump_module(module, destination=None, inherited=False, defaults=False):
|
||||
return False
|
||||
elif field.scope != Scope.settings:
|
||||
return False
|
||||
elif defaults == True:
|
||||
elif defaults:
|
||||
return True
|
||||
else:
|
||||
return field.values != field.default
|
||||
|
||||
Reference in New Issue
Block a user