Commit 8e36197c by Chris Dodge

tweeks per Cale's feedback

parent 73113edd
......@@ -9,7 +9,7 @@ from request_cache.middleware import RequestCache
from django.core.cache import get_cache, InvalidCacheBackendError
class Command(BaseCommand):
help = '''Delete a MongoDB backed course'''
help = '''Enumerates through the course and find common errors'''
def handle(self, *args, **options):
if len(args) != 1 :
......@@ -38,10 +38,9 @@ class Command(BaseCommand):
# we've had a bug where the xml_attributes field can we rewritten as a string rather than a dict
def _check_xml_attributes_field(module):
err_cnt = 0
if hasattr(module, 'xml_attributes'):
if isinstance(module.xml_attributes, str) or isinstance(module.xml_attributes, unicode):
print 'module = {0} has xml_attributes as a string. It should be a dict'.format(module.location.url())
err_cnt = err_cnt + 1
if hasattr(module, 'xml_attributes') and isinstance(module.xml_attributes, basestring):
print 'module = {0} has xml_attributes as a string. It should be a dict'.format(module.location.url())
err_cnt = err_cnt + 1
for child in module.get_children():
err_cnt = err_cnt + _check_xml_attributes_field(child)
return err_cnt
......
......@@ -379,10 +379,11 @@ def check_module_metadata_editability(module):
allowed = allowed + ['xml_attributes', 'display_name']
err_cnt = 0
my_metadata = dict(own_metadata(module))
for key in my_metadata.keys():
if key not in allowed:
err_cnt = err_cnt + 1
print ': found metadata on {0}. Studio will not support editing this piece of metadata, so it is not allowed. Metadata: {1} = {2}'. format(module.location.url(), key, my_metadata[key])
illegal_keys = set(own_metadata(module).keys()) - set(allowed)
if len(illegal_keys) > 0:
err_cnt = err_cnt + 1
print ': found non-editable metadata on {0}. These metadata keys are not supported = {1}'. format(module.location.url(), illegal_keys)
return err_cnt
......
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