diff --git a/common/lib/xmodule/xmodule/capa_module.py b/common/lib/xmodule/xmodule/capa_module.py
index 322dab5d91..b53c29ef86 100644
--- a/common/lib/xmodule/xmodule/capa_module.py
+++ b/common/lib/xmodule/xmodule/capa_module.py
@@ -135,7 +135,7 @@ class CapaModule(XModule):
try:
self.lcp = LoncapaProblem(self.definition['data'], self.location.html_id(), instance_state, seed=seed, system=self.system)
except Exception:
- msg = 'cannot create LoncapaProblem %s' % self.url
+ msg = 'cannot create LoncapaProblem %s' % self.location.url
log.exception(msg)
if self.system.DEBUG:
msg = '
%s
' % msg.replace('<', '<')
diff --git a/common/lib/xmodule/xmodule/modulestore/__init__.py b/common/lib/xmodule/xmodule/modulestore/__init__.py
index faee5ce303..b8ab95d85e 100644
--- a/common/lib/xmodule/xmodule/modulestore/__init__.py
+++ b/common/lib/xmodule/xmodule/modulestore/__init__.py
@@ -6,6 +6,9 @@ that are stored in a database an accessible using their Location as an identifie
import re
from collections import namedtuple
from .exceptions import InvalidLocationError
+import logging
+
+log = logging.getLogger('mitx.' + 'modulestore')
URL_RE = re.compile("""
(?P[^:]+)://
@@ -74,11 +77,13 @@ class Location(_LocationBase):
def check_list(list_):
for val in list_:
if val is not None and INVALID_CHARS.search(val) is not None:
+ log.debug('invalid characters val="%s", list_="%s"' % (val,list_))
raise InvalidLocationError(location)
if isinstance(location, basestring):
match = URL_RE.match(location)
if match is None:
+ log.debug('location is instance of %s but no URL match' % basestring)
raise InvalidLocationError(location)
else:
groups = match.groupdict()
@@ -86,6 +91,7 @@ class Location(_LocationBase):
return _LocationBase.__new__(_cls, **groups)
elif isinstance(location, (list, tuple)):
if len(location) not in (5, 6):
+ log.debug('location has wrong length')
raise InvalidLocationError(location)
if len(location) == 5:
diff --git a/common/lib/xmodule/xmodule/modulestore/xml.py b/common/lib/xmodule/xmodule/modulestore/xml.py
index a5db17054b..9a67ea59f9 100644
--- a/common/lib/xmodule/xmodule/modulestore/xml.py
+++ b/common/lib/xmodule/xmodule/modulestore/xml.py
@@ -12,7 +12,7 @@ from .exceptions import ItemNotFoundError
etree.set_default_parser(etree.XMLParser(dtd_validation=False, load_dtd=False,
remove_comments=True, remove_blank_text=True))
-log = logging.getLogger(__name__)
+log = logging.getLogger('mitx.' + __name__)
class XMLModuleStore(ModuleStore):
@@ -35,9 +35,13 @@ class XMLModuleStore(ModuleStore):
self.default_class = None
else:
module_path, _, class_name = default_class.rpartition('.')
+ log.debug('module_path = %s' % module_path)
class_ = getattr(import_module(module_path), class_name)
self.default_class = class_
+ log.debug('XMLModuleStore: eager=%s, data_dir = %s' % (eager,self.data_dir))
+ log.debug('default_class = %s' % self.default_class)
+
with open(self.data_dir / "course.xml") as course_file:
class ImportSystem(XMLParsingSystem, MakoDescriptorSystem):
def __init__(self, modulestore):
@@ -65,9 +69,11 @@ class XMLModuleStore(ModuleStore):
slug = '{slug}_{count}'.format(slug=slug, count=self.unnamed_modules)
self.used_slugs.add(slug)
+ # log.debug('-> slug=%s' % slug)
xml_data.set('slug', slug)
module = XModuleDescriptor.load_from_xml(etree.tostring(xml_data), self, org, course, modulestore.default_class)
+ log.debug('==> importing module location %s' % repr(module.location))
modulestore.modules[module.location] = module
if eager:
@@ -84,6 +90,7 @@ class XMLModuleStore(ModuleStore):
XMLParsingSystem.__init__(self, **system_kwargs)
self.course = ImportSystem(self).process_xml(course_file.read())
+ log.debug('========> Done with course import')
def get_item(self, location):
"""
diff --git a/common/lib/xmodule/xmodule/x_module.py b/common/lib/xmodule/xmodule/x_module.py
index 8bfbb5f91a..e3668b7ff1 100644
--- a/common/lib/xmodule/xmodule/x_module.py
+++ b/common/lib/xmodule/xmodule/x_module.py
@@ -344,6 +344,8 @@ class XModuleDescriptor(Plugin):
etree.fromstring(xml_data).tag,
default_class
)
+ # leave next line in code, commented out - useful for low-level debugging
+ # log.debug('[XModuleDescriptor.load_from_xml] tag=%s, class_=%s' % (etree.fromstring(xml_data).tag,class_))
return class_.from_xml(xml_data, system, org, course)
@classmethod
diff --git a/common/lib/xmodule/xmodule/xml_module.py b/common/lib/xmodule/xmodule/xml_module.py
index aebb024a59..16016ca23f 100644
--- a/common/lib/xmodule/xmodule/xml_module.py
+++ b/common/lib/xmodule/xmodule/xml_module.py
@@ -125,6 +125,7 @@ class XmlDescriptor(XModuleDescriptor):
definition_xml = copy.deepcopy(xml_object)
else:
filepath = cls._format_filepath(xml_object.tag, filename)
+ log.debug('filepath=%s, resources_fs=%s' % (filepath,system.resources_fs))
with system.resources_fs.open(filepath) as file:
try:
definition_xml = etree.parse(file).getroot()
diff --git a/lms/djangoapps/courseware/views.py b/lms/djangoapps/courseware/views.py
index a7dc4bdc65..c6dbf84ff1 100644
--- a/lms/djangoapps/courseware/views.py
+++ b/lms/djangoapps/courseware/views.py
@@ -209,9 +209,12 @@ def index(request, course=None, chapter=None, section=None,
chapter = clean(chapter)
section = clean(section)
+ if settings.ENABLE_MULTICOURSE:
+ settings.MODULESTORE['default']['OPTIONS']['data_dir'] = settings.DATA_DIR + multicourse_settings.get_course_xmlpath(course)
+
context = {
'csrf': csrf(request)['csrf_token'],
- 'accordion': render_accordion(request, course, chapter, section),
+ 'accordion': render_accordion(request, course, chapter, section), # triggers course load!
'COURSE_TITLE': multicourse_settings.get_course_title(course),
'init': '',
'content': ''
diff --git a/lms/envs/common.py b/lms/envs/common.py
index 33800c6afb..3803a8fde4 100644
--- a/lms/envs/common.py
+++ b/lms/envs/common.py
@@ -39,6 +39,7 @@ MITX_FEATURES = {
'USE_DJANGO_PIPELINE' : True,
'DISPLAY_HISTOGRAMS_TO_STAFF' : True,
'REROUTE_ACTIVATION_EMAIL' : False, # nonempty string = address for all activation emails
+ 'DEBUG_LEVEL' : 0, # 0 = lowest level, least verbose, 255 = max level, most verbose
}
# Used for A/B testing
diff --git a/lms/envs/dev_ike.py b/lms/envs/dev_ike.py
index c70be74352..3e6efed1c1 100644
--- a/lms/envs/dev_ike.py
+++ b/lms/envs/dev_ike.py
@@ -35,20 +35,22 @@ EDX4EDX_ROOT = ENV_ROOT / "data/edx4edx"
DEBUG = True
ENABLE_MULTICOURSE = True # set to False to disable multicourse display (see lib.util.views.mitxhome)
-QUICKEDIT = True
+QUICKEDIT = False
MAKO_TEMPLATES['course'] = [DATA_DIR, EDX4EDX_ROOT ]
#MITX_FEATURES['USE_DJANGO_PIPELINE'] = False
MITX_FEATURES['DISPLAY_HISTOGRAMS_TO_STAFF'] = False
MITX_FEATURES['DISPLAY_EDIT_LINK'] = True
+MITX_FEATURES['DEBUG_LEVEL'] = 10 # 0 = lowest level, least verbose, 255 = max level, most verbose
-COURSE_SETTINGS = {'6.002x_Fall_2012': {'number' : '6.002x',
+COURSE_SETTINGS = {'6002x_Fall_2012': {'number' : '6.002x',
'title' : 'Circuits and Electronics',
'xmlpath': '/6002x-fall-2012/',
'active' : True,
'default_chapter' : 'Week_1',
'default_section' : 'Administrivia_and_Circuit_Elements',
+ 'location': 'i4x://edx/6002xs12/course/6002x Fall 2012',
},
'8.02_Spring_2013': {'number' : '8.02x',
'title' : 'Electricity & Magnetism',
@@ -81,6 +83,7 @@ COURSE_SETTINGS = {'6.002x_Fall_2012': {'number' : '6.002x',
'active' : True,
'default_chapter' : 'Introduction',
'default_section' : 'edx4edx_Course',
+ 'location': 'i4x://edx/6002xs12/course/edx4edx',
},
'7.03x_Fall_2012': {'number' : '7.03x',
'title' : 'Genetics',