diff --git a/common/djangoapps/mitxmako/shortcuts.py b/common/djangoapps/mitxmako/shortcuts.py index 181d3befd5..ebeb0fc180 100644 --- a/common/djangoapps/mitxmako/shortcuts.py +++ b/common/djangoapps/mitxmako/shortcuts.py @@ -12,10 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -import logging - -log = logging.getLogger("mitx." + __name__) - from django.template import Context from django.http import HttpResponse diff --git a/common/lib/xmodule/xmodule/html_module.py b/common/lib/xmodule/xmodule/html_module.py index df77f43a17..c11c7d22e7 100644 --- a/common/lib/xmodule/xmodule/html_module.py +++ b/common/lib/xmodule/xmodule/html_module.py @@ -7,15 +7,14 @@ from lxml import etree from lxml.html import rewrite_links from path import path -from .x_module import XModule from pkg_resources import resource_string -from .xml_module import XmlDescriptor, name_to_pathname -from .editing_module import EditingDescriptor -from .stringify import stringify_children -from .html_checker import check_html -from xmodule.modulestore import Location - from xmodule.contentstore.content import XASSET_SRCREF_PREFIX, StaticContent +from xmodule.editing_module import EditingDescriptor +from xmodule.html_checker import check_html +from xmodule.modulestore import Location +from xmodule.stringify import stringify_children +from xmodule.x_module import XModule +from xmodule.xml_module import XmlDescriptor, name_to_pathname log = logging.getLogger("mitx.courseware") @@ -164,7 +163,7 @@ class HtmlDescriptor(XmlDescriptor, EditingDescriptor): resource_fs.makedir(os.path.dirname(filepath), allow_recreate=True) with resource_fs.open(filepath, 'w') as file: - file.write(self.definition['data']) # .encode('utf-8')) + file.write(self.definition['data'].encode('utf-8')) # write out the relative name relname = path(pathname).basename() diff --git a/common/lib/xmodule/xmodule/xml_module.py b/common/lib/xmodule/xmodule/xml_module.py index 91768d8e11..bb5b44c67f 100644 --- a/common/lib/xmodule/xmodule/xml_module.py +++ b/common/lib/xmodule/xmodule/xml_module.py @@ -1,17 +1,17 @@ -from xmodule.x_module import (XModuleDescriptor, policy_key) -from xmodule.modulestore import Location -from lxml import etree import json import copy import logging -import traceback -from collections import namedtuple -from fs.errors import ResourceNotFoundError import os import sys +from collections import namedtuple +from lxml import etree + +from xmodule.x_module import (XModuleDescriptor, policy_key) +from xmodule.modulestore import Location log = logging.getLogger(__name__) +# assume all XML files are persisted as utf-8. edx_xml_parser = etree.XMLParser(dtd_validation=False, load_dtd=False, remove_comments=True, remove_blank_text=True, encoding='utf-8') @@ -207,7 +207,6 @@ class XmlDescriptor(XModuleDescriptor): definition_xml = cls.load_file(filepath, system.resources_fs, location) - log.info(' read definition XML: %s', definition_xml) definition_metadata = get_metadata_from_xml(definition_xml) cls.clean_metadata_from_xml(definition_xml) definition = cls.definition_from_xml(definition_xml, system) diff --git a/common/test/data/full/about/faq.html b/common/test/data/full/about/faq.html index a5e54c9f15..a173e46753 100644 --- a/common/test/data/full/about/faq.html +++ b/common/test/data/full/about/faq.html @@ -6,7 +6,7 @@

No - anyone and everyone is welcome to take this course.

  • What textbook should I buy? -

    Although the lectures are designed to be self-contained, we recommend (but do not require) that students refer to the book Worlds Together, Worlds Apart: A History of the World: From 1000 CE to the Present (W W Norton, 3rd edition) -- Volume II, which was written specifically for this course.

    +

    Although the lectures are designed to be self-contained, we recommend (but do not require) that students refer to the book Worlds Together, Worlds Apart: A History of the World: From 1000 CE to the Present (W W Norton, 3rd edition) — Volume II, which was written specifically for this course.

  • Does Harvard award credentials or reports regarding my work in this course?

    Princeton does not award credentials or issue reports for student work in this course. However, Coursera could maintain a record of your score on the assessments and, with your permission, verify that score for authorized parties.

    diff --git a/common/test/data/full/problem/H1P3_Poor_Workmanship.xml b/common/test/data/full/problem/H1P3_Poor_Workmanship.xml index cf9db4053a..f32b9eb271 100644 --- a/common/test/data/full/problem/H1P3_Poor_Workmanship.xml +++ b/common/test/data/full/problem/H1P3_Poor_Workmanship.xml @@ -78,7 +78,8 @@ So the total heating power in Joe's shop was:
    -No wonder Joe was cold. + +No wonder Joe was cold… diff --git a/common/test/data/full/problem/Lab_0_Using_the_Tools.xml b/common/test/data/full/problem/Lab_0_Using_the_Tools.xml index b5f593c294..c270773da3 100644 --- a/common/test/data/full/problem/Lab_0_Using_the_Tools.xml +++ b/common/test/data/full/problem/Lab_0_Using_the_Tools.xml @@ -94,7 +94,7 @@ scope probes to nodes A, B and C and edit their properties so that the plots will be different colors. Now run a transient analysis for 5ms. Move the mouse over the plot until the marker (a vertical dashed line that follows the mouse when it's over the plot) is at approximately -1.25ms. Please report the measured voltages for nodes A, B and C. +1.25ms. Please report the measured voltages for nodes A, B and C…
    diff --git a/common/test/data/full/problem/Sample_Algebraic_Problem.xml b/common/test/data/full/problem/Sample_Algebraic_Problem.xml index 7bea1cc92e..85b9a2fcc4 100644 --- a/common/test/data/full/problem/Sample_Algebraic_Problem.xml +++ b/common/test/data/full/problem/Sample_Algebraic_Problem.xml @@ -6,7 +6,7 @@ z = "A*x^2 + sqrt(y)" Enter the algebraic expression \(A x^2 + \sqrt{y}\) in the box below. The entry is case sensitive. The product must be indicated with an asterisk, and the exponentation with a caret, so you must write -"A*x^2 + sqrt(y)". +"A*x^2 + sqrt(y)"… diff --git a/common/test/data/full/problem/Sample_Numeric_Problem.xml b/common/test/data/full/problem/Sample_Numeric_Problem.xml index f41881a028..fef9b4648c 100644 --- a/common/test/data/full/problem/Sample_Numeric_Problem.xml +++ b/common/test/data/full/problem/Sample_Numeric_Problem.xml @@ -1,6 +1,6 @@ Enter the numerical value of the expression \(x + y\) where -\(x = 3\) and \(y = 5\). +\(x = 3\) and \(y = 5\)… diff --git a/lms/djangoapps/courseware/tests/tests.py b/lms/djangoapps/courseware/tests/tests.py index b4510dcb3c..673f7d968c 100644 --- a/lms/djangoapps/courseware/tests/tests.py +++ b/lms/djangoapps/courseware/tests/tests.py @@ -75,21 +75,8 @@ def xml_store_config(data_dir): } } -def my_xml_store_config(data_dir): - return { - 'default': { - 'ENGINE': 'xmodule.modulestore.xml.XMLModuleStore', - 'OPTIONS': { - 'data_dir': data_dir, - 'default_class': 'xmodule.hidden_module.HiddenDescriptor', - } - } -} - TEST_DATA_DIR = settings.COMMON_TEST_DATA_ROOT -# TEST_DATA_MONGO_MODULESTORE = mongo_store_config(TEST_DATA_DIR) TEST_DATA_XML_MODULESTORE = xml_store_config(TEST_DATA_DIR) -MY_TEST_DATA_XML_MODULESTORE = my_xml_store_config(TEST_DATA_DIR) REAL_DATA_DIR = settings.GITHUB_REPO_ROOT REAL_DATA_MODULESTORE = mongo_store_config(REAL_DATA_DIR) @@ -281,25 +268,15 @@ class PageLoader(ActivateLoginTestCase): def check_xml_pages_load(self, course_name, data_dir, modstore): """Make all locations in course load""" print "Checking course {0} in {1}".format(course_name, data_dir) - default_class='xmodule.hidden_module.HiddenDescriptor' # 'xmodule.raw_module.RawDescriptor', + default_class='xmodule.hidden_module.HiddenDescriptor' load_error_modules=True -# load_error_modules=False module_store = XMLModuleStore( data_dir, default_class=default_class, course_dirs=[course_name], load_error_modules=load_error_modules, ) -# for course_id in module_store.modules.keys(): -# for module in module_store.modules[course_id].itervalues(): -# -# if 'data' in module.definition: -# store.update_item(module.location, module.definition['data']) -# if 'children' in module.definition: -# store.update_children(module.location, module.definition['children']) -# # NOTE: It's important to use own_metadata here to avoid writing -# # inherited metadata everywhere. -# store.update_metadata(module.location, dict(module.own_metadata)) + # enroll in the course before trying to access pages courses = module_store.get_courses() self.assertEqual(len(courses), 1) @@ -328,7 +305,6 @@ class PageLoader(ActivateLoginTestCase): all_ok = False num_bad += 1 content = resp.content -# contentlines = content.splitlines() if content.find("this module is temporarily unavailable")>=0: msg = "ERROR unavailable module " all_ok = False @@ -341,16 +317,15 @@ class PageLoader(ActivateLoginTestCase): log.info('Output the content returned for page %s', descriptor.location.url()) log.info('Content returned: %s', content) print msg -# self.assertTrue(all_ok) # fail fast + self.assertTrue(all_ok) # fail fast print "{0}/{1} good".format(n - num_bad, n) log.info( "{0}/{1} good".format(n - num_bad, n)) -# self.assertTrue(all_ok) - self.assertTrue(false) + self.assertTrue(all_ok) -#@override_settings(MODULESTORE=TEST_DATA_MONGO_MODULESTORE) -@override_settings(MODULESTORE=MY_TEST_DATA_XML_MODULESTORE) + +@override_settings(MODULESTORE=TEST_DATA_XML_MODULESTORE) class TestCoursesLoadTestCase(PageLoader): '''Check that all pages in test courses load properly'''