From c555bf5a8d470a3a3a21784859c6e6769d49c878 Mon Sep 17 00:00:00 2001 From: ichuang Date: Thu, 3 Jan 2013 22:57:24 -0500 Subject: [PATCH 01/11] fix capa to add contextualize_text for optionresponse and multiplechoice --- common/lib/capa/capa/responsetypes.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common/lib/capa/capa/responsetypes.py b/common/lib/capa/capa/responsetypes.py index 3e79ca2084..1bc34b70a3 100644 --- a/common/lib/capa/capa/responsetypes.py +++ b/common/lib/capa/capa/responsetypes.py @@ -629,7 +629,7 @@ class MultipleChoiceResponse(LoncapaResponse): # define correct choices (after calling secondary setup) xml = self.xml cxml = xml.xpath('//*[@id=$id]//choice[@correct="true"]', id=xml.get('id')) - self.correct_choices = [choice.get('name') for choice in cxml] + self.correct_choices = [contextualize_text(choice.get('name'), self.context) for choice in cxml] def mc_setup_response(self): ''' @@ -723,7 +723,7 @@ class OptionResponse(LoncapaResponse): return cmap def get_answers(self): - amap = dict([(af.get('id'), af.get('correct')) for af in self.answer_fields]) + amap = dict([(af.get('id'), contextualize_text(af.get('correct'), self.context)) for af in self.answer_fields]) # log.debug('%s: expected answers=%s' % (unicode(self),amap)) return amap From bf3669395b675a6cdbdd893ed869bc943daf41de Mon Sep 17 00:00:00 2001 From: ichuang Date: Sat, 5 Jan 2013 16:47:40 +0000 Subject: [PATCH 02/11] update symmath snuggletex server --- lms/lib/symmath/formula.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lms/lib/symmath/formula.py b/lms/lib/symmath/formula.py index 1698b004d9..fb5b210a27 100644 --- a/lms/lib/symmath/formula.py +++ b/lms/lib/symmath/formula.py @@ -422,7 +422,8 @@ class formula(object): def GetContentMathML(self, asciimath, mathml): # URL = 'http://192.168.1.2:8080/snuggletex-webapp-1.2.2/ASCIIMathMLUpConversionDemo' - URL = 'http://127.0.0.1:8080/snuggletex-webapp-1.2.2/ASCIIMathMLUpConversionDemo' + # URL = 'http://127.0.0.1:8080/snuggletex-webapp-1.2.2/ASCIIMathMLUpConversionDemo' + URL = 'http://math-xserver.mitx.mit.edu/snuggletex-webapp-1.2.2/ASCIIMathMLUpConversionDemo' if 1: payload = {'asciiMathInput': asciimath, From 9a0d85667ca0027d5a4b69f44c9ae56cbc37c5a5 Mon Sep 17 00:00:00 2001 From: ichuang Date: Sat, 5 Jan 2013 17:24:54 +0000 Subject: [PATCH 03/11] symmath use https, no server cert verify --- lms/lib/symmath/formula.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lms/lib/symmath/formula.py b/lms/lib/symmath/formula.py index fb5b210a27..bab0ab3691 100644 --- a/lms/lib/symmath/formula.py +++ b/lms/lib/symmath/formula.py @@ -423,7 +423,7 @@ class formula(object): def GetContentMathML(self, asciimath, mathml): # URL = 'http://192.168.1.2:8080/snuggletex-webapp-1.2.2/ASCIIMathMLUpConversionDemo' # URL = 'http://127.0.0.1:8080/snuggletex-webapp-1.2.2/ASCIIMathMLUpConversionDemo' - URL = 'http://math-xserver.mitx.mit.edu/snuggletex-webapp-1.2.2/ASCIIMathMLUpConversionDemo' + URL = 'https://math-xserver.mitx.mit.edu/snuggletex-webapp-1.2.2/ASCIIMathMLUpConversionDemo' if 1: payload = {'asciiMathInput': asciimath, @@ -431,7 +431,7 @@ class formula(object): #'asciiMathML':unicode(mathml).encode('utf-8'), } headers = {'User-Agent': "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.13) Gecko/20080311 Firefox/2.0.0.13"} - r = requests.post(URL, data=payload, headers=headers) + r = requests.post(URL, data=payload, headers=headers, verify=False) r.encoding = 'utf-8' ret = r.text #print "encoding: ",r.encoding From faa23732562117d0e490d6af665e698236bc612a Mon Sep 17 00:00:00 2001 From: Robert Chirwa Date: Fri, 4 Jan 2013 13:34:59 -0500 Subject: [PATCH 04/11] Fix typo in the job page MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Carlos Andrés Rocha --- lms/templates/static_templates/jobs.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lms/templates/static_templates/jobs.html b/lms/templates/static_templates/jobs.html index d783403970..f2752a0939 100644 --- a/lms/templates/static_templates/jobs.html +++ b/lms/templates/static_templates/jobs.html @@ -38,7 +38,7 @@

EdX is looking to add new talent to our team!

Our mission is to give a world-class education to everyone, everywhere, regardless of gender, income or social status

-

Today, EdX.org, a not-for-profit provides hundreds of thousands of people from around the globe with access free education.  We offer amazing quality classes by the best professors from the best schools. We enable our members to uncover a new passion that will transform their lives and their communities.

+

Today, EdX.org, a not-for-profit provides hundreds of thousands of people from around the globe with access to free education.  We offer amazing quality classes by the best professors from the best schools. We enable our members to uncover a new passion that will transform their lives and their communities.

Around the world-from coast to coast, in over 192 countries, people are making the decision to take one or several of our courses. As we continue to grow our operations, we are looking for talented, passionate people with great ideas to join the edX team. We aim to create an environment that is supportive, diverse, and as fun as our brand. If you're results-oriented, dedicated, and ready to contribute to an unparalleled member experience for our community, we really want you to apply.

As part of the edX team, you’ll receive:

    From 56f1c6aad93533d1d6e68ffe1e06cd6188816641 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Andr=C3=A9s=20Rocha?= Date: Mon, 7 Jan 2013 10:14:00 -0500 Subject: [PATCH 05/11] Fixed extra characters in faq page --- lms/templates/static_templates/faq.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lms/templates/static_templates/faq.html b/lms/templates/static_templates/faq.html index 030eaa5013..b0543df264 100644 --- a/lms/templates/static_templates/faq.html +++ b/lms/templates/static_templates/faq.html @@ -21,7 +21,7 @@

    What is edX?

    edX is a not-for-profit enterprise of its founding partners, the Massachusetts Institute of Technology (MIT) and Harvard University that offers online learning to on-campus students and to millions of people around the world. To do so, edX is building an open-source online learning platform and hosts an online web portal at www.edx.org for online education.

    -

    EdX currently offers HarvardX, MITx and BerkeleyX classes online for free. Beginning in fall 2013, edX will offer WellesleyX and GeorgetownX classes online for free. The University of Texas System includes nine universities and six health institutions. The edX institutions aim to extend their collective reach to build a global community of online students. Along with offering online courses, the three universities undertake research on how students learn and how technology can transform learning – both on-campus and online throughout the world.

    +

    EdX currently offers HarvardX, MITx and BerkeleyX classes online for free. Beginning in fall 2013, edX will offer WellesleyX and GeorgetownX classes online for free. The University of Texas System includes nine universities and six health institutions. The edX institutions aim to extend their collective reach to build a global community of online students. Along with offering online courses, the three universities undertake research on how students learn and how technology can transform learning both on-campus and online throughout the world.

    From 0c6e8c4820876efdb94173135e315a6f158f7624 Mon Sep 17 00:00:00 2001 From: Jay Zoldak Date: Mon, 7 Jan 2013 14:08:18 -0500 Subject: [PATCH 06/11] Clarify that you need to start up the mongo daemon --- doc/development.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/doc/development.md b/doc/development.md index ebc56fbf1b..36827aafeb 100644 --- a/doc/development.md +++ b/doc/development.md @@ -19,6 +19,11 @@ Use the MacPorts package `mongodb` or the Homebrew formula `mongodb` ## Initializing Mongodb +First start up the mongo daemon. E.g. to start it up in the background +using a config file: + + mongod --config /usr/local/etc/mongod.conf & + Check out the course data directories that you want to work with into the `GITHUB_REPO_ROOT` (by default, `../data`). Then run the following command: From d3fd6ac151e9a79d5a9118c6f076084849078765 Mon Sep 17 00:00:00 2001 From: Jay Zoldak Date: Mon, 7 Jan 2013 15:23:08 -0500 Subject: [PATCH 07/11] Clarify the syntax of the rake fasttest command --- doc/development.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/doc/development.md b/doc/development.md index 36827aafeb..56415b691e 100644 --- a/doc/development.md +++ b/doc/development.md @@ -42,8 +42,12 @@ This runs all the tests (long, uses collectstatic): If if you aren't changing static files, can run `rake test` once, then run - rake fasttest_{lms,cms} + rake fasttest_lms +or + + rake fasttest_cms + xmodule can be tested independently, with this: rake test_common/lib/xmodule From fc0a7614bf6e1c189613cac69a5ecdd5f887567a Mon Sep 17 00:00:00 2001 From: David Ormsbee Date: Tue, 8 Jan 2013 11:21:22 -0500 Subject: [PATCH 08/11] Load courses in dir name order, keep separate ParentTracker per course. --- .../xmodule/xmodule/modulestore/__init__.py | 2 +- .../lib/xmodule/xmodule/modulestore/mongo.py | 2 +- .../lib/xmodule/xmodule/modulestore/search.py | 2 +- common/lib/xmodule/xmodule/modulestore/xml.py | 19 ++++++++++--------- 4 files changed, 13 insertions(+), 12 deletions(-) diff --git a/common/lib/xmodule/xmodule/modulestore/__init__.py b/common/lib/xmodule/xmodule/modulestore/__init__.py index 5b94add68f..42c516a199 100644 --- a/common/lib/xmodule/xmodule/modulestore/__init__.py +++ b/common/lib/xmodule/xmodule/modulestore/__init__.py @@ -345,7 +345,7 @@ class ModuleStore(object): ''' raise NotImplementedError - def get_parent_locations(self, location): + def get_parent_locations(self, location, course_id): '''Find all locations that are the parents of this location. Needed for path_to_location(). diff --git a/common/lib/xmodule/xmodule/modulestore/mongo.py b/common/lib/xmodule/xmodule/modulestore/mongo.py index baa4e7870c..cc4d1a7cda 100644 --- a/common/lib/xmodule/xmodule/modulestore/mongo.py +++ b/common/lib/xmodule/xmodule/modulestore/mongo.py @@ -309,7 +309,7 @@ class MongoModuleStore(ModuleStoreBase): self._update_single_item(location, {'metadata': metadata}) - def get_parent_locations(self, location): + def get_parent_locations(self, location, course_id): '''Find all locations that are the parents of this location. Needed for path_to_location(). diff --git a/common/lib/xmodule/xmodule/modulestore/search.py b/common/lib/xmodule/xmodule/modulestore/search.py index f9901e8bfe..4a5ece6854 100644 --- a/common/lib/xmodule/xmodule/modulestore/search.py +++ b/common/lib/xmodule/xmodule/modulestore/search.py @@ -64,7 +64,7 @@ def path_to_location(modulestore, course_id, location): # isn't found so we don't have to do it explicitly. Call this # first to make sure the location is there (even if it's a course, and # we would otherwise immediately exit). - parents = modulestore.get_parent_locations(loc) + parents = modulestore.get_parent_locations(loc, course_id) # print 'Processing loc={0}, path={1}'.format(loc, path) if loc.category == "course": diff --git a/common/lib/xmodule/xmodule/modulestore/xml.py b/common/lib/xmodule/xmodule/modulestore/xml.py index 6b3ff9bff4..bee3ca4440 100644 --- a/common/lib/xmodule/xmodule/modulestore/xml.py +++ b/common/lib/xmodule/xmodule/modulestore/xml.py @@ -275,14 +275,15 @@ class XMLModuleStore(ModuleStoreBase): class_ = getattr(import_module(module_path), class_name) self.default_class = class_ - self.parent_tracker = ParentTracker() + # self.parent_tracker = ParentTracker() + self.parent_trackers = defaultdict(ParentTracker) # If we are specifically asked for missing courses, that should # be an error. If we are asked for "all" courses, find the ones # that have a course.xml if course_dirs is None: - course_dirs = [d for d in os.listdir(self.data_dir) if - os.path.exists(self.data_dir / d / "course.xml")] + course_dirs = sorted([d for d in os.listdir(self.data_dir) if + os.path.exists(self.data_dir / d / "course.xml")]) for course_dir in course_dirs: self.try_load_course(course_dir) @@ -307,7 +308,7 @@ class XMLModuleStore(ModuleStoreBase): if course_descriptor is not None: self.courses[course_dir] = course_descriptor self._location_errors[course_descriptor.location] = errorlog - self.parent_tracker.make_known(course_descriptor.location) + self.parent_trackers[course_descriptor.id].make_known(course_descriptor.location) else: # Didn't load course. Instead, save the errors elsewhere. self.errored_courses[course_dir] = errorlog @@ -432,7 +433,7 @@ class XMLModuleStore(ModuleStoreBase): course_dir, policy, tracker, - self.parent_tracker, + self.parent_trackers[course_id], self.load_error_modules, ) @@ -541,7 +542,7 @@ class XMLModuleStore(ModuleStoreBase): """ raise NotImplementedError("XMLModuleStores are read-only") - def get_parent_locations(self, location): + def get_parent_locations(self, location, course_id): '''Find all locations that are the parents of this location. Needed for path_to_location(). @@ -552,7 +553,7 @@ class XMLModuleStore(ModuleStoreBase): be empty if there are no parents. ''' location = Location.ensure_fully_specified(location) - if not self.parent_tracker.is_known(location): - raise ItemNotFoundError(location) + if not self.parent_trackers[course_id].is_known(location): + raise ItemNotFoundError("{0} not in {1}".format(location, course_id)) - return self.parent_tracker.parents(location) + return self.parent_trackers[course_id].parents(location) From 8952eda98d0953c210eb159f24fd0ddce26cfb81 Mon Sep 17 00:00:00 2001 From: David Ormsbee Date: Tue, 8 Jan 2013 13:34:22 -0500 Subject: [PATCH 09/11] XML loaded courses should no longer be able to throw NoPathToItem. The parent trees are built on a per-course basis (so it'll throw ItemNotFoundError if an item exists in a different course from the one you're asking after. NoPathToItem can still happen with MongoDB backed courseware. They store things like the info page as HTML snippets which are orphaned from other content. --- .../xmodule/modulestore/tests/test_modulestore.py | 9 --------- 1 file changed, 9 deletions(-) diff --git a/common/lib/xmodule/xmodule/modulestore/tests/test_modulestore.py b/common/lib/xmodule/xmodule/modulestore/tests/test_modulestore.py index c1d1d50a53..64816581ce 100644 --- a/common/lib/xmodule/xmodule/modulestore/tests/test_modulestore.py +++ b/common/lib/xmodule/xmodule/modulestore/tests/test_modulestore.py @@ -23,12 +23,3 @@ def check_path_to_location(modulestore): for location in not_found: assert_raises(ItemNotFoundError, path_to_location, modulestore, course_id, location) - # Since our test files are valid, there shouldn't be any - # elements with no path to them. But we can look for them in - # another course. - no_path = ( - "i4x://edX/simple/video/Lost_Video", - ) - for location in no_path: - assert_raises(NoPathToItem, path_to_location, modulestore, course_id, location) - From 051339afb03252d8166fd816cf5cf81961df1a58 Mon Sep 17 00:00:00 2001 From: David Ormsbee Date: Tue, 8 Jan 2013 13:54:44 -0500 Subject: [PATCH 10/11] Tiny cleanup. --- common/lib/xmodule/xmodule/modulestore/xml.py | 1 - 1 file changed, 1 deletion(-) diff --git a/common/lib/xmodule/xmodule/modulestore/xml.py b/common/lib/xmodule/xmodule/modulestore/xml.py index bee3ca4440..f967cd0a7f 100644 --- a/common/lib/xmodule/xmodule/modulestore/xml.py +++ b/common/lib/xmodule/xmodule/modulestore/xml.py @@ -275,7 +275,6 @@ class XMLModuleStore(ModuleStoreBase): class_ = getattr(import_module(module_path), class_name) self.default_class = class_ - # self.parent_tracker = ParentTracker() self.parent_trackers = defaultdict(ParentTracker) # If we are specifically asked for missing courses, that should From 1122cdb2862b3ef13c6a438a8bf4baaa350811f1 Mon Sep 17 00:00:00 2001 From: David Ormsbee Date: Tue, 8 Jan 2013 16:37:31 -0500 Subject: [PATCH 11/11] Added more comments in response to code review. --- common/lib/xmodule/xmodule/modulestore/__init__.py | 4 ++-- common/lib/xmodule/xmodule/modulestore/mongo.py | 4 ++-- common/lib/xmodule/xmodule/modulestore/xml.py | 8 +++++--- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/common/lib/xmodule/xmodule/modulestore/__init__.py b/common/lib/xmodule/xmodule/modulestore/__init__.py index 42c516a199..f86a6e9600 100644 --- a/common/lib/xmodule/xmodule/modulestore/__init__.py +++ b/common/lib/xmodule/xmodule/modulestore/__init__.py @@ -346,8 +346,8 @@ class ModuleStore(object): raise NotImplementedError def get_parent_locations(self, location, course_id): - '''Find all locations that are the parents of this location. Needed - for path_to_location(). + '''Find all locations that are the parents of this location in this + course. Needed for path_to_location(). returns an iterable of things that can be passed to Location. ''' diff --git a/common/lib/xmodule/xmodule/modulestore/mongo.py b/common/lib/xmodule/xmodule/modulestore/mongo.py index cc4d1a7cda..4c7ef3c050 100644 --- a/common/lib/xmodule/xmodule/modulestore/mongo.py +++ b/common/lib/xmodule/xmodule/modulestore/mongo.py @@ -310,8 +310,8 @@ class MongoModuleStore(ModuleStoreBase): self._update_single_item(location, {'metadata': metadata}) def get_parent_locations(self, location, course_id): - '''Find all locations that are the parents of this location. Needed - for path_to_location(). + '''Find all locations that are the parents of this location in this + course. Needed for path_to_location(). If there is no data at location in this modulestore, raise ItemNotFoundError. diff --git a/common/lib/xmodule/xmodule/modulestore/xml.py b/common/lib/xmodule/xmodule/modulestore/xml.py index f967cd0a7f..04f3a94d1b 100644 --- a/common/lib/xmodule/xmodule/modulestore/xml.py +++ b/common/lib/xmodule/xmodule/modulestore/xml.py @@ -279,7 +279,9 @@ class XMLModuleStore(ModuleStoreBase): # If we are specifically asked for missing courses, that should # be an error. If we are asked for "all" courses, find the ones - # that have a course.xml + # that have a course.xml. We sort the dirs in alpha order so we always + # read things in the same order (OS differences in load order have + # bitten us in the past.) if course_dirs is None: course_dirs = sorted([d for d in os.listdir(self.data_dir) if os.path.exists(self.data_dir / d / "course.xml")]) @@ -542,8 +544,8 @@ class XMLModuleStore(ModuleStoreBase): raise NotImplementedError("XMLModuleStores are read-only") def get_parent_locations(self, location, course_id): - '''Find all locations that are the parents of this location. Needed - for path_to_location(). + '''Find all locations that are the parents of this location in this + course. Needed for path_to_location(). If there is no data at location in this modulestore, raise ItemNotFoundError.