From c54972e8557ea60fb7c263c0b8e3af2bef58e0fa Mon Sep 17 00:00:00 2001 From: Calen Pennington Date: Tue, 1 Apr 2014 16:02:29 -0400 Subject: [PATCH 1/3] Fix bad interaction between pluggable InputTypes and Microsites Pluggable InputTypes use edxmako.paths.add_lookup to inject new mako template directories. Those were getting clobbered by microsites (and by theming), which were completely rebuilding the mako template lookup list from scratch. This commit switches those two features to use the same add_lookup function as pluggable InputTypes. [LMS-2489] --- common/djangoapps/edxmako/paths.py | 11 +++++++---- lms/startup.py | 6 ++---- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/common/djangoapps/edxmako/paths.py b/common/djangoapps/edxmako/paths.py index a29a68e8b3..518f8a530b 100644 --- a/common/djangoapps/edxmako/paths.py +++ b/common/djangoapps/edxmako/paths.py @@ -15,11 +15,14 @@ class DynamicTemplateLookup(TemplateLookup): A specialization of the standard mako `TemplateLookup` class which allows for adding directories progressively. """ - def add_directory(self, directory): + def add_directory(self, directory, prepend=False): """ Add a new directory to the template lookup path. """ - self.directories.append(os.path.normpath(directory)) + if prepend: + self.directories.insert(0, os.path.normpath(directory)) + else: + self.directories.append(os.path.normpath(directory)) def clear_lookups(namespace): @@ -29,7 +32,7 @@ def clear_lookups(namespace): if namespace in LOOKUP: del LOOKUP[namespace] -def add_lookup(namespace, directory, package=None): +def add_lookup(namespace, directory, package=None, prepend=False): """ Adds a new mako template lookup directory to the given namespace. @@ -48,7 +51,7 @@ def add_lookup(namespace, directory, package=None): ) if package: directory = pkg_resources.resource_filename(package, directory) - templates.add_directory(directory) + templates.add_directory(directory, prepend=prepend) def lookup_template(namespace, name): diff --git a/lms/startup.py b/lms/startup.py index 462fb3f8fd..ea4d27b167 100644 --- a/lms/startup.py +++ b/lms/startup.py @@ -52,8 +52,7 @@ def enable_theme(): # Include the theme's templates in the template search paths settings.TEMPLATE_DIRS.insert(0, theme_root / 'templates') - settings.MAKO_TEMPLATES['main'].insert(0, theme_root / 'templates') - edxmako.startup.run() + edxmako.paths.add_lookup('main', theme_root / 'templates', prepend=True) # Namespace the theme's static files to 'themes/' to # avoid collisions with default edX static files @@ -98,8 +97,7 @@ def enable_microsites(): # if we have any valid microsites defined, let's wire in the Mako and STATIC_FILES search paths if microsite_config_dict: settings.TEMPLATE_DIRS.append(microsites_root) - settings.MAKO_TEMPLATES['main'].append(microsites_root) - edxmako.startup.run() + edxmako.paths.add_lookup('main', microsites_root) settings.STATICFILES_DIRS.insert(0, microsites_root) From 8935166c7ae42c9eaff1f4628c65a151b7be95a0 Mon Sep 17 00:00:00 2001 From: Adam Palay Date: Wed, 2 Apr 2014 11:00:51 -0400 Subject: [PATCH 2/3] Revert "Open ended panel headings not internationalized." This reverts commit eb9133aeb687c0d103feec16371ad7d2bce952a8. ORA-352 --- .../open_ended_notifications.py | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/lms/djangoapps/open_ended_grading/open_ended_notifications.py b/lms/djangoapps/open_ended_grading/open_ended_notifications.py index 5826560ab4..2e2880ca9d 100644 --- a/lms/djangoapps/open_ended_grading/open_ended_notifications.py +++ b/lms/djangoapps/open_ended_grading/open_ended_notifications.py @@ -3,7 +3,6 @@ import json import logging from django.conf import settings -from django.utils.translation import ugettext_lazy as _ from xmodule.open_ended_grading_classes import peer_grading_service from xmodule.open_ended_grading_classes.controller_query_service import ControllerQueryService @@ -24,16 +23,10 @@ NOTIFICATION_CACHE_TIME = 300 KEY_PREFIX = "open_ended_" NOTIFICATION_TYPES = ( - # Translators: "Peer Grading" is a panel where peer can grade student-provided answers. - ('student_needs_to_peer_grade', 'peer_grading', _('Peer Grading')), - # Translators: "Staff Grading" is a panel where instructor can grade student-provided answers. - ('staff_needs_to_grade', 'staff_grading', _('Staff Grading')), - # Translators: "Problems you have submitted" refers to the problems that the currently-logged-in - # student has provided an answer for. - ('new_student_grading_to_view', 'open_ended_problems', _('Problems you have submitted')), - # Translators: "Flagged Submissions" refers to student-provided answers to a problem which are - # marked by instructor or peer graders as 'flagged' potentially inappropriate. - ('flagged_submissions_exist', 'open_ended_flagged_problems', _('Flagged Submissions')) + ('student_needs_to_peer_grade', 'peer_grading', 'Peer Grading'), + ('staff_needs_to_grade', 'staff_grading', 'Staff Grading'), + ('new_student_grading_to_view', 'open_ended_problems', 'Problems you have submitted'), + ('flagged_submissions_exist', 'open_ended_flagged_problems', 'Flagged Submissions') ) From e6e818a5a225f6c630050edb2368a51f3e4dcd70 Mon Sep 17 00:00:00 2001 From: Stephen Sanchez Date: Wed, 2 Apr 2014 16:05:54 -0400 Subject: [PATCH 3/3] Updating the hash of the ORA2 release candidate in the requirements --- requirements/edx/github.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements/edx/github.txt b/requirements/edx/github.txt index 7c38bec23a..0044952ca1 100644 --- a/requirements/edx/github.txt +++ b/requirements/edx/github.txt @@ -26,7 +26,7 @@ -e git+https://github.com/edx/bok-choy.git@25a47b3bf87c503fc4996e52addac83b42ec6f38#egg=bok_choy -e git+https://github.com/edx-solutions/django-splash.git@9965a53c269666a30bb4e2b3f6037c138aef2a55#egg=django-splash -e git+https://github.com/edx/acid-block.git@459aff7b63db8f2c5decd1755706c1a64fb4ebb1#egg=acid-xblock --e git+https://github.com/edx/edx-ora2.git@26fc1126c5ba322a04b1094c5e6481e2fd36dab3#egg=edx-ora2 +-e git+https://github.com/edx/edx-ora2.git@dfc5e4cb603708a627fbe407c20f80ff723205b8#egg=edx-ora2 # Prototype XBlocks for limited roll-outs and user testing. These are not for general use. -e git+https://github.com/pmitros/ConceptXBlock.git@2376fde9ebdd83684b78dde77ef96361c3bd1aa0#egg=concept-xblock