WIP: added a get_modulestore_type. Added some unit tests. changed over the isinstance() with respect to modulestores to use this get_modulestore_type()

This commit is contained in:
Chris Dodge
2013-07-24 08:40:04 -04:00
parent b5253b52b6
commit 82988972ad
9 changed files with 57 additions and 23 deletions

View File

@@ -8,7 +8,7 @@ from django.http import Http404
from .module_render import get_module
from xmodule.course_module import CourseDescriptor
from xmodule.modulestore import Location
from xmodule.modulestore import Location, MONGO_MODULESTORE_TYPE
from xmodule.modulestore.django import modulestore
from xmodule.contentstore.content import StaticContent
from xmodule.modulestore.xml import XMLModuleStore
@@ -82,7 +82,7 @@ def get_opt_course_with_access(user, course_id, action):
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):
if modulestore().get_modulestore_type(course.course_id) == MONGO_MODULESTORE_TYPE:
return '/static/' + course.data_dir + "/images/course_image.jpg"
else:
loc = course.location._replace(tag='c4x', category='asset', name='images_course_image.jpg')