Make the LMS check_course command work again.
This commit is contained in:
@@ -14,6 +14,10 @@ import mitxmako.middleware as middleware
|
||||
middleware.MakoMiddleware()
|
||||
|
||||
def check_names(user, course):
|
||||
'''
|
||||
Complain if any problems have alphanumeric names.
|
||||
TODO (vshnayder): there are some in 6.002x that don't. Is that actually a problem?
|
||||
'''
|
||||
all_ok = True
|
||||
print "Confirming all problems have alphanumeric names"
|
||||
for problem in course.xpath('//problem'):
|
||||
@@ -53,7 +57,10 @@ def check_sections(user, course):
|
||||
print "Checking all section includes are valid XML"
|
||||
for f in os.listdir(sections_dir):
|
||||
sectionfile = sections_dir + '/' + f
|
||||
print sectionfile
|
||||
#print sectionfile
|
||||
# skip non-xml files:
|
||||
if not sectionfile.endswith('xml'):
|
||||
continue
|
||||
try:
|
||||
etree.parse(sectionfile)
|
||||
except Exception as ex:
|
||||
@@ -69,12 +76,23 @@ class Command(BaseCommand):
|
||||
help = "Does basic validity tests on course.xml."
|
||||
def handle(self, *args, **options):
|
||||
all_ok = True
|
||||
|
||||
# TODO (vshnayder): create dummy user objects. Anon, authenticated, staff.
|
||||
# Check that everything works for each.
|
||||
# The objects probably shouldn't be actual django users to avoid unneeded
|
||||
# dependency on django.
|
||||
|
||||
# TODO: use args as list of files to check. Fix loading to work for other files.
|
||||
|
||||
sample_user = User.objects.all()[0]
|
||||
|
||||
|
||||
print "Attempting to load courseware"
|
||||
course = course_file(sample_user)
|
||||
|
||||
to_run = [check_names,
|
||||
# TODO (vshnayder) : make check_rendering work (use module_render.py),
|
||||
# turn it on
|
||||
# check_rendering,
|
||||
check_sections,
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user