WIP. Data loads, but not all of it
This commit is contained in:
@@ -85,7 +85,7 @@ def course_image_url(course):
|
||||
"""Try to look up the image url for the course. If it's not found,
|
||||
log an error and return the dead link"""
|
||||
if isinstance(modulestore(), XMLModuleStore):
|
||||
path = course.metadata['data_dir'] + "/images/course_image.jpg"
|
||||
path = course.data_dir + "/images/course_image.jpg"
|
||||
return try_staticfiles_lookup(path)
|
||||
else:
|
||||
loc = course.location._replace(tag='c4x', category='asset', name='images_course_image.jpg')
|
||||
@@ -162,7 +162,9 @@ def get_course_about_section(course, section_key):
|
||||
key=section_key, url=course.location.url()))
|
||||
return None
|
||||
elif section_key == "title":
|
||||
return course.metadata.get('display_name', course.url_name)
|
||||
if course.display_name is None:
|
||||
return course.url_name
|
||||
return course.display_name
|
||||
elif section_key == "university":
|
||||
return course.location.org
|
||||
elif section_key == "number":
|
||||
@@ -220,7 +222,7 @@ def get_course_syllabus_section(course, section_key):
|
||||
filepath = find_file(fs, dirs, section_key + ".html")
|
||||
with fs.open(filepath) as htmlFile:
|
||||
return replace_urls(htmlFile.read().decode('utf-8'),
|
||||
course.metadata['data_dir'], course_namespace=course.location)
|
||||
course.data_dir, course_namespace=course.location)
|
||||
except ResourceNotFoundError:
|
||||
log.exception("Missing syllabus section {key} in course {url}".format(
|
||||
key=section_key, url=course.location.url()))
|
||||
|
||||
@@ -245,7 +245,7 @@ def _get_module(user, request, location, student_module_cache, course_id, positi
|
||||
make_psychometrics_data_update_handler(instance_module))
|
||||
|
||||
try:
|
||||
module = descriptor.xmodule_constructor(system)(instance_state, shared_state)
|
||||
module = descriptor.xmodule(system)
|
||||
except:
|
||||
log.exception("Error creating module from descriptor {0}".format(descriptor))
|
||||
|
||||
@@ -259,7 +259,7 @@ def _get_module(user, request, location, student_module_cache, course_id, positi
|
||||
error_msg=exc_info_to_str(sys.exc_info()))
|
||||
|
||||
# Make an error module
|
||||
return err_descriptor.xmodule_constructor(system)(None, None)
|
||||
return err_descriptor.xmodule(system)
|
||||
|
||||
_get_html = module.get_html
|
||||
|
||||
|
||||
Reference in New Issue
Block a user