From c6ee8eb68d8863f580a8faee0b4fae0a2d4e658e Mon Sep 17 00:00:00 2001
From: Nimisha Asthagiri
Date: Mon, 4 Dec 2017 17:04:20 -0500
Subject: [PATCH 1/3] Move ACE Common code out of Schedules
---
openedx/core/djangoapps/ace_common/__init__.py | 1 +
openedx/core/djangoapps/ace_common/apps.py | 7 +++++++
.../{schedules => ace_common}/template_context.py | 0
.../ace_common}/edx_ace/common/base_body.html | 0
.../ace_common}/edx_ace/common/base_head.html | 0
.../edx_ace/common/return_to_course_cta.html | 0
.../ace_common}/edx_ace/common/upsell_cta.html | 0
.../ace_common}/edx_ace/common/upsell_cta.txt | 0
.../templatetags/__init__.py | 0
.../{schedules => ace_common}/templatetags/ace.py | 0
.../core/djangoapps/ace_common/tests/__init__.py | 0
.../{schedules => ace_common}/tests/mixins.py | 0
.../tests/test_templatetags.py | 0
.../tests/test_tracking.py | 0
.../{schedules => ace_common}/tracking.py | 0
.../core/djangoapps/schedules/{ => docs}/README.rst | 0
.../schedules/{ => docs}/img/system_diagram.png | Bin
17 files changed, 8 insertions(+)
create mode 100644 openedx/core/djangoapps/ace_common/__init__.py
create mode 100644 openedx/core/djangoapps/ace_common/apps.py
rename openedx/core/djangoapps/{schedules => ace_common}/template_context.py (100%)
rename openedx/core/djangoapps/{schedules/templates/schedules => ace_common/templates/ace_common}/edx_ace/common/base_body.html (100%)
rename openedx/core/djangoapps/{schedules/templates/schedules => ace_common/templates/ace_common}/edx_ace/common/base_head.html (100%)
rename openedx/core/djangoapps/{schedules/templates/schedules => ace_common/templates/ace_common}/edx_ace/common/return_to_course_cta.html (100%)
rename openedx/core/djangoapps/{schedules/templates/schedules => ace_common/templates/ace_common}/edx_ace/common/upsell_cta.html (100%)
rename openedx/core/djangoapps/{schedules/templates/schedules => ace_common/templates/ace_common}/edx_ace/common/upsell_cta.txt (100%)
rename openedx/core/djangoapps/{schedules => ace_common}/templatetags/__init__.py (100%)
rename openedx/core/djangoapps/{schedules => ace_common}/templatetags/ace.py (100%)
create mode 100644 openedx/core/djangoapps/ace_common/tests/__init__.py
rename openedx/core/djangoapps/{schedules => ace_common}/tests/mixins.py (100%)
rename openedx/core/djangoapps/{schedules => ace_common}/tests/test_templatetags.py (100%)
rename openedx/core/djangoapps/{schedules => ace_common}/tests/test_tracking.py (100%)
rename openedx/core/djangoapps/{schedules => ace_common}/tracking.py (100%)
rename openedx/core/djangoapps/schedules/{ => docs}/README.rst (100%)
rename openedx/core/djangoapps/schedules/{ => docs}/img/system_diagram.png (100%)
diff --git a/openedx/core/djangoapps/ace_common/__init__.py b/openedx/core/djangoapps/ace_common/__init__.py
new file mode 100644
index 0000000000..af927a92b1
--- /dev/null
+++ b/openedx/core/djangoapps/ace_common/__init__.py
@@ -0,0 +1 @@
+default_app_config = 'openedx.core.djangoapps.ace_common.apps.AceCommonConfig'
diff --git a/openedx/core/djangoapps/ace_common/apps.py b/openedx/core/djangoapps/ace_common/apps.py
new file mode 100644
index 0000000000..96ba22cd0f
--- /dev/null
+++ b/openedx/core/djangoapps/ace_common/apps.py
@@ -0,0 +1,7 @@
+from django.apps import AppConfig
+from django.utils.translation import ugettext_lazy as _
+
+
+class AceCommonConfig(AppConfig):
+ name = 'openedx.core.djangoapps.ace_common'
+ verbose_name = _('ACE Common')
diff --git a/openedx/core/djangoapps/schedules/template_context.py b/openedx/core/djangoapps/ace_common/template_context.py
similarity index 100%
rename from openedx/core/djangoapps/schedules/template_context.py
rename to openedx/core/djangoapps/ace_common/template_context.py
diff --git a/openedx/core/djangoapps/schedules/templates/schedules/edx_ace/common/base_body.html b/openedx/core/djangoapps/ace_common/templates/ace_common/edx_ace/common/base_body.html
similarity index 100%
rename from openedx/core/djangoapps/schedules/templates/schedules/edx_ace/common/base_body.html
rename to openedx/core/djangoapps/ace_common/templates/ace_common/edx_ace/common/base_body.html
diff --git a/openedx/core/djangoapps/schedules/templates/schedules/edx_ace/common/base_head.html b/openedx/core/djangoapps/ace_common/templates/ace_common/edx_ace/common/base_head.html
similarity index 100%
rename from openedx/core/djangoapps/schedules/templates/schedules/edx_ace/common/base_head.html
rename to openedx/core/djangoapps/ace_common/templates/ace_common/edx_ace/common/base_head.html
diff --git a/openedx/core/djangoapps/schedules/templates/schedules/edx_ace/common/return_to_course_cta.html b/openedx/core/djangoapps/ace_common/templates/ace_common/edx_ace/common/return_to_course_cta.html
similarity index 100%
rename from openedx/core/djangoapps/schedules/templates/schedules/edx_ace/common/return_to_course_cta.html
rename to openedx/core/djangoapps/ace_common/templates/ace_common/edx_ace/common/return_to_course_cta.html
diff --git a/openedx/core/djangoapps/schedules/templates/schedules/edx_ace/common/upsell_cta.html b/openedx/core/djangoapps/ace_common/templates/ace_common/edx_ace/common/upsell_cta.html
similarity index 100%
rename from openedx/core/djangoapps/schedules/templates/schedules/edx_ace/common/upsell_cta.html
rename to openedx/core/djangoapps/ace_common/templates/ace_common/edx_ace/common/upsell_cta.html
diff --git a/openedx/core/djangoapps/schedules/templates/schedules/edx_ace/common/upsell_cta.txt b/openedx/core/djangoapps/ace_common/templates/ace_common/edx_ace/common/upsell_cta.txt
similarity index 100%
rename from openedx/core/djangoapps/schedules/templates/schedules/edx_ace/common/upsell_cta.txt
rename to openedx/core/djangoapps/ace_common/templates/ace_common/edx_ace/common/upsell_cta.txt
diff --git a/openedx/core/djangoapps/schedules/templatetags/__init__.py b/openedx/core/djangoapps/ace_common/templatetags/__init__.py
similarity index 100%
rename from openedx/core/djangoapps/schedules/templatetags/__init__.py
rename to openedx/core/djangoapps/ace_common/templatetags/__init__.py
diff --git a/openedx/core/djangoapps/schedules/templatetags/ace.py b/openedx/core/djangoapps/ace_common/templatetags/ace.py
similarity index 100%
rename from openedx/core/djangoapps/schedules/templatetags/ace.py
rename to openedx/core/djangoapps/ace_common/templatetags/ace.py
diff --git a/openedx/core/djangoapps/ace_common/tests/__init__.py b/openedx/core/djangoapps/ace_common/tests/__init__.py
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/openedx/core/djangoapps/schedules/tests/mixins.py b/openedx/core/djangoapps/ace_common/tests/mixins.py
similarity index 100%
rename from openedx/core/djangoapps/schedules/tests/mixins.py
rename to openedx/core/djangoapps/ace_common/tests/mixins.py
diff --git a/openedx/core/djangoapps/schedules/tests/test_templatetags.py b/openedx/core/djangoapps/ace_common/tests/test_templatetags.py
similarity index 100%
rename from openedx/core/djangoapps/schedules/tests/test_templatetags.py
rename to openedx/core/djangoapps/ace_common/tests/test_templatetags.py
diff --git a/openedx/core/djangoapps/schedules/tests/test_tracking.py b/openedx/core/djangoapps/ace_common/tests/test_tracking.py
similarity index 100%
rename from openedx/core/djangoapps/schedules/tests/test_tracking.py
rename to openedx/core/djangoapps/ace_common/tests/test_tracking.py
diff --git a/openedx/core/djangoapps/schedules/tracking.py b/openedx/core/djangoapps/ace_common/tracking.py
similarity index 100%
rename from openedx/core/djangoapps/schedules/tracking.py
rename to openedx/core/djangoapps/ace_common/tracking.py
diff --git a/openedx/core/djangoapps/schedules/README.rst b/openedx/core/djangoapps/schedules/docs/README.rst
similarity index 100%
rename from openedx/core/djangoapps/schedules/README.rst
rename to openedx/core/djangoapps/schedules/docs/README.rst
diff --git a/openedx/core/djangoapps/schedules/img/system_diagram.png b/openedx/core/djangoapps/schedules/docs/img/system_diagram.png
similarity index 100%
rename from openedx/core/djangoapps/schedules/img/system_diagram.png
rename to openedx/core/djangoapps/schedules/docs/img/system_diagram.png
From 7ef443f7ce1a192b6d2f09493af5a368b71d81b9 Mon Sep 17 00:00:00 2001
From: Nimisha Asthagiri
Date: Mon, 4 Dec 2017 18:11:40 -0500
Subject: [PATCH 2/3] Update usages to ace_common
---
cms/envs/common.py | 1 +
lms/djangoapps/discussion/tasks.py | 2 +-
.../discussion/edx_ace/responsenotification/email/body.html | 4 ++--
.../discussion/edx_ace/responsenotification/email/head.html | 2 +-
lms/djangoapps/discussion/tests/test_tasks.py | 2 +-
lms/envs/common.py | 1 +
openedx/core/djangoapps/ace_common/templatetags/ace.py | 4 ++--
.../core/djangoapps/ace_common/tests/test_templatetags.py | 6 +++---
openedx/core/djangoapps/ace_common/tests/test_tracking.py | 4 ++--
openedx/core/djangoapps/schedules/resolvers.py | 2 +-
.../schedules/edx_ace/courseupdate/email/body.html | 6 +++---
.../templates/schedules/edx_ace/courseupdate/email/body.txt | 2 +-
.../schedules/edx_ace/courseupdate/email/head.html | 2 +-
.../schedules/edx_ace/recurringnudge_day10/email/body.html | 6 +++---
.../schedules/edx_ace/recurringnudge_day10/email/body.txt | 2 +-
.../schedules/edx_ace/recurringnudge_day10/email/head.html | 2 +-
.../schedules/edx_ace/recurringnudge_day3/email/body.html | 6 +++---
.../schedules/edx_ace/recurringnudge_day3/email/body.txt | 2 +-
.../schedules/edx_ace/recurringnudge_day3/email/head.html | 2 +-
.../schedules/edx_ace/upgradereminder/email/body.html | 2 +-
.../schedules/edx_ace/upgradereminder/email/head.html | 2 +-
.../{schedules => ace_common}/edx_ace/common/base_body.html | 0
.../edx_ace/common/return_to_course_cta.html | 0
.../schedules/edx_ace/recurringnudge_day3/email/body.txt | 2 +-
24 files changed, 33 insertions(+), 31 deletions(-)
rename themes/red-theme/lms/templates/{schedules => ace_common}/edx_ace/common/base_body.html (100%)
rename themes/red-theme/lms/templates/{schedules => ace_common}/edx_ace/common/return_to_course_cta.html (100%)
diff --git a/cms/envs/common.py b/cms/envs/common.py
index 24fa7cd7b2..b859640f3e 100644
--- a/cms/envs/common.py
+++ b/cms/envs/common.py
@@ -1118,6 +1118,7 @@ INSTALLED_APPS = [
'openedx.core.djangoapps.waffle_utils',
# Dynamic schedules
+ 'openedx.core.djangoapps.ace_common.apps.AceCommonConfig',
'openedx.core.djangoapps.schedules.apps.SchedulesConfig',
# DRF filters
diff --git a/lms/djangoapps/discussion/tasks.py b/lms/djangoapps/discussion/tasks.py
index d725819019..ad268ec3db 100644
--- a/lms/djangoapps/discussion/tasks.py
+++ b/lms/djangoapps/discussion/tasks.py
@@ -20,7 +20,7 @@ from lms.djangoapps.django_comment_client.utils import permalink
import lms.lib.comment_client as cc
from openedx.core.djangoapps.content.course_overviews.models import CourseOverview
-from openedx.core.djangoapps.schedules.template_context import get_base_template_context
+from openedx.core.djangoapps.ace_common.template_context import get_base_template_context
from openedx.core.lib.celery.task_utils import emulate_http_request
diff --git a/lms/djangoapps/discussion/templates/discussion/edx_ace/responsenotification/email/body.html b/lms/djangoapps/discussion/templates/discussion/edx_ace/responsenotification/email/body.html
index 5aedd82535..5bdcdb9074 100644
--- a/lms/djangoapps/discussion/templates/discussion/edx_ace/responsenotification/email/body.html
+++ b/lms/djangoapps/discussion/templates/discussion/edx_ace/responsenotification/email/body.html
@@ -1,4 +1,4 @@
-{% extends 'schedules/edx_ace/common/base_body.html' %}
+{% extends 'ace_common/edx_ace/common/base_body.html' %}
{% load i18n %}
{% load static %}
@@ -19,7 +19,7 @@
{% trans "View discussion" as course_cta_text %}
- {% include "schedules/edx_ace/common/return_to_course_cta.html" with course_cta_text=course_cta_text course_cta_url=post_link%}
+ {% include "ace_common/edx_ace/common/return_to_course_cta.html" with course_cta_text=course_cta_text course_cta_url=post_link%}
{% block google_analytics_pixel %}
diff --git a/lms/djangoapps/discussion/templates/discussion/edx_ace/responsenotification/email/head.html b/lms/djangoapps/discussion/templates/discussion/edx_ace/responsenotification/email/head.html
index 588357ec65..366ada7ad9 100644
--- a/lms/djangoapps/discussion/templates/discussion/edx_ace/responsenotification/email/head.html
+++ b/lms/djangoapps/discussion/templates/discussion/edx_ace/responsenotification/email/head.html
@@ -1 +1 @@
-{% extends 'schedules/edx_ace/common/base_head.html' %}
+{% extends 'ace_common/edx_ace/common/base_head.html' %}
diff --git a/lms/djangoapps/discussion/tests/test_tasks.py b/lms/djangoapps/discussion/tests/test_tasks.py
index 5573ca5a0c..985ff3f5c9 100644
--- a/lms/djangoapps/discussion/tests/test_tasks.py
+++ b/lms/djangoapps/discussion/tests/test_tasks.py
@@ -21,7 +21,7 @@ from lms.djangoapps.discussion.config.waffle import waffle, FORUM_RESPONSE_NOTIF
from lms.djangoapps.discussion.signals.handlers import ENABLE_FORUM_NOTIFICATIONS_FOR_SITE_KEY
from lms.djangoapps.discussion.tasks import _should_send_message
from openedx.core.djangoapps.content.course_overviews.tests.factories import CourseOverviewFactory
-from openedx.core.djangoapps.schedules.template_context import get_base_template_context
+from openedx.core.djangoapps.ace_common.template_context import get_base_template_context
from openedx.core.djangoapps.site_configuration.tests.factories import SiteConfigurationFactory
from openedx.core.djangoapps.theming.middleware import CurrentSiteThemeMiddleware
from openedx.core.djangoapps.waffle_utils.testutils import override_waffle_flag
diff --git a/lms/envs/common.py b/lms/envs/common.py
index 4c6da20741..de666c6b47 100644
--- a/lms/envs/common.py
+++ b/lms/envs/common.py
@@ -2331,6 +2331,7 @@ INSTALLED_APPS = [
'database_fixups',
'openedx.core.djangoapps.waffle_utils',
+ 'openedx.core.djangoapps.ace_common.apps.AceCommonConfig',
'openedx.core.djangoapps.schedules.apps.SchedulesConfig',
# Course Goals
diff --git a/openedx/core/djangoapps/ace_common/templatetags/ace.py b/openedx/core/djangoapps/ace_common/templatetags/ace.py
index d2beffa219..c9b6975ae4 100644
--- a/openedx/core/djangoapps/ace_common/templatetags/ace.py
+++ b/openedx/core/djangoapps/ace_common/templatetags/ace.py
@@ -1,10 +1,10 @@
-from urlparse import urlparse, parse_qs
+from urlparse import urlparse
from crum import get_current_request
from django import template
from django.utils.safestring import mark_safe
-from openedx.core.djangoapps.schedules.tracking import CampaignTrackingInfo, GoogleAnalyticsTrackingPixel
+from openedx.core.djangoapps.ace_common.tracking import CampaignTrackingInfo, GoogleAnalyticsTrackingPixel
from openedx.core.djangolib.markup import HTML
register = template.Library()
diff --git a/openedx/core/djangoapps/ace_common/tests/test_templatetags.py b/openedx/core/djangoapps/ace_common/tests/test_templatetags.py
index f223fc76c6..a517068cd8 100644
--- a/openedx/core/djangoapps/ace_common/tests/test_templatetags.py
+++ b/openedx/core/djangoapps/ace_common/tests/test_templatetags.py
@@ -6,13 +6,13 @@ from django.test import override_settings
from mock import patch
from edx_ace import Message, Recipient
-from openedx.core.djangoapps.schedules.templatetags.ace import (
+from openedx.core.djangoapps.ace_common.templatetags.ace import (
ensure_url_is_absolute,
with_link_tracking,
google_analytics_tracking_pixel,
_get_google_analytics_tracking_url
)
-from openedx.core.djangoapps.schedules.tests.mixins import QueryStringAssertionMixin
+from openedx.core.djangoapps.ace_common.tests.mixins import QueryStringAssertionMixin
from openedx.core.djangoapps.site_configuration.tests.factories import SiteFactory
from openedx.core.djangolib.testing.utils import CacheIsolationTestCase, skip_unless_lms
from student.tests.factories import UserFactory
@@ -41,7 +41,7 @@ class TestAbsoluteUrl(CacheIsolationTestCase):
class EmailTemplateTagMixin(object):
def setUp(self):
- patcher = patch('openedx.core.djangoapps.schedules.templatetags.ace.get_current_request')
+ patcher = patch('openedx.core.djangoapps.ace_common.templatetags.ace.get_current_request')
self.mock_get_current_request = patcher.start()
self.addCleanup(patcher.stop)
diff --git a/openedx/core/djangoapps/ace_common/tests/test_tracking.py b/openedx/core/djangoapps/ace_common/tests/test_tracking.py
index 8acae97b49..e734f9f739 100644
--- a/openedx/core/djangoapps/ace_common/tests/test_tracking.py
+++ b/openedx/core/djangoapps/ace_common/tests/test_tracking.py
@@ -2,8 +2,8 @@ from unittest import TestCase
from django.test import override_settings
-from openedx.core.djangoapps.schedules.tests.mixins import QueryStringAssertionMixin
-from openedx.core.djangoapps.schedules.tracking import (
+from openedx.core.djangoapps.ace_common.tests.mixins import QueryStringAssertionMixin
+from openedx.core.djangoapps.ace_common.tracking import (
CampaignTrackingInfo,
DEFAULT_CAMPAIGN_SOURCE,
DEFAULT_CAMPAIGN_MEDIUM,
diff --git a/openedx/core/djangoapps/schedules/resolvers.py b/openedx/core/djangoapps/schedules/resolvers.py
index b2ace23c44..4edf290d27 100644
--- a/openedx/core/djangoapps/schedules/resolvers.py
+++ b/openedx/core/djangoapps/schedules/resolvers.py
@@ -19,7 +19,7 @@ from openedx.core.djangoapps.schedules.content_highlights import get_week_highli
from openedx.core.djangoapps.schedules.exceptions import CourseUpdateDoesNotExist
from openedx.core.djangoapps.schedules.models import Schedule, ScheduleExperience
from openedx.core.djangoapps.schedules.utils import PrefixedDebugLoggerMixin
-from openedx.core.djangoapps.schedules.template_context import get_base_template_context
+from openedx.core.djangoapps.ace_common.template_context import get_base_template_context
from openedx.core.djangoapps.site_configuration.models import SiteConfiguration
from openedx.features.course_experience import course_home_url_name
diff --git a/openedx/core/djangoapps/schedules/templates/schedules/edx_ace/courseupdate/email/body.html b/openedx/core/djangoapps/schedules/templates/schedules/edx_ace/courseupdate/email/body.html
index 4be7dcd00e..3dd1a3b3a9 100644
--- a/openedx/core/djangoapps/schedules/templates/schedules/edx_ace/courseupdate/email/body.html
+++ b/openedx/core/djangoapps/schedules/templates/schedules/edx_ace/courseupdate/email/body.html
@@ -1,4 +1,4 @@
-{% extends 'schedules/edx_ace/common/base_body.html' %}
+{% extends 'ace_common/edx_ace/common/base_body.html' %}
{% load i18n %}
{% block preview_text %}
@@ -31,9 +31,9 @@
{% trans "Resume your course now" as course_cta_text %}
- {% include "schedules/edx_ace/common/return_to_course_cta.html" with course_cta_text=course_cta_text%}
+ {% include "ace_common/edx_ace/common/return_to_course_cta.html" with course_cta_text=course_cta_text%}
- {% include "schedules/edx_ace/common/upsell_cta.html"%}
+ {% include "ace_common/edx_ace/common/upsell_cta.html"%}
diff --git a/openedx/core/djangoapps/schedules/templates/schedules/edx_ace/courseupdate/email/body.txt b/openedx/core/djangoapps/schedules/templates/schedules/edx_ace/courseupdate/email/body.txt
index eea8f8c70e..33b44c994e 100644
--- a/openedx/core/djangoapps/schedules/templates/schedules/edx_ace/courseupdate/email/body.txt
+++ b/openedx/core/djangoapps/schedules/templates/schedules/edx_ace/courseupdate/email/body.txt
@@ -14,5 +14,5 @@ We want to let you know what you can look forward to in week {{ week_num }}:
With self-paced courses, you learn on your own schedule. We encourage you to spend time with the course each week.
Your focused attention will pay off in the end!
{% endblocktrans %}
-{% include "schedules/edx_ace/common/upsell_cta.txt"%}
+{% include "ace_common/edx_ace/common/upsell_cta.txt"%}
{% endautoescape %}
diff --git a/openedx/core/djangoapps/schedules/templates/schedules/edx_ace/courseupdate/email/head.html b/openedx/core/djangoapps/schedules/templates/schedules/edx_ace/courseupdate/email/head.html
index 588357ec65..366ada7ad9 100644
--- a/openedx/core/djangoapps/schedules/templates/schedules/edx_ace/courseupdate/email/head.html
+++ b/openedx/core/djangoapps/schedules/templates/schedules/edx_ace/courseupdate/email/head.html
@@ -1 +1 @@
-{% extends 'schedules/edx_ace/common/base_head.html' %}
+{% extends 'ace_common/edx_ace/common/base_head.html' %}
diff --git a/openedx/core/djangoapps/schedules/templates/schedules/edx_ace/recurringnudge_day10/email/body.html b/openedx/core/djangoapps/schedules/templates/schedules/edx_ace/recurringnudge_day10/email/body.html
index a50b8e11f8..b0d186bc2c 100644
--- a/openedx/core/djangoapps/schedules/templates/schedules/edx_ace/recurringnudge_day10/email/body.html
+++ b/openedx/core/djangoapps/schedules/templates/schedules/edx_ace/recurringnudge_day10/email/body.html
@@ -1,4 +1,4 @@
-{% extends 'schedules/edx_ace/common/base_body.html' %}
+{% extends 'ace_common/edx_ace/common/base_body.html' %}
{% load i18n %}
{% block preview_text %}
@@ -36,9 +36,9 @@
{% trans "Keep learning" as course_cta_text %}
- {% include "schedules/edx_ace/common/return_to_course_cta.html" with course_cta_text=course_cta_text%}
+ {% include "ace_common/edx_ace/common/return_to_course_cta.html" with course_cta_text=course_cta_text%}
- {% include "schedules/edx_ace/common/upsell_cta.html"%}
+ {% include "ace_common/edx_ace/common/upsell_cta.html"%}
diff --git a/openedx/core/djangoapps/schedules/templates/schedules/edx_ace/recurringnudge_day10/email/body.txt b/openedx/core/djangoapps/schedules/templates/schedules/edx_ace/recurringnudge_day10/email/body.txt
index 8760535e3f..8a58cb909e 100644
--- a/openedx/core/djangoapps/schedules/templates/schedules/edx_ace/recurringnudge_day10/email/body.txt
+++ b/openedx/core/djangoapps/schedules/templates/schedules/edx_ace/recurringnudge_day10/email/body.txt
@@ -14,5 +14,5 @@
{% endblocktrans %}
{% trans "Keep learning" %} <{% with_link_tracking course_url %}>
{% endif %}
-{% include "schedules/edx_ace/common/upsell_cta.txt"%}
+{% include "ace_common/edx_ace/common/upsell_cta.txt"%}
{% endautoescape %}
diff --git a/openedx/core/djangoapps/schedules/templates/schedules/edx_ace/recurringnudge_day10/email/head.html b/openedx/core/djangoapps/schedules/templates/schedules/edx_ace/recurringnudge_day10/email/head.html
index 588357ec65..366ada7ad9 100644
--- a/openedx/core/djangoapps/schedules/templates/schedules/edx_ace/recurringnudge_day10/email/head.html
+++ b/openedx/core/djangoapps/schedules/templates/schedules/edx_ace/recurringnudge_day10/email/head.html
@@ -1 +1 @@
-{% extends 'schedules/edx_ace/common/base_head.html' %}
+{% extends 'ace_common/edx_ace/common/base_head.html' %}
diff --git a/openedx/core/djangoapps/schedules/templates/schedules/edx_ace/recurringnudge_day3/email/body.html b/openedx/core/djangoapps/schedules/templates/schedules/edx_ace/recurringnudge_day3/email/body.html
index d748594fc7..c47c2e7305 100644
--- a/openedx/core/djangoapps/schedules/templates/schedules/edx_ace/recurringnudge_day3/email/body.html
+++ b/openedx/core/djangoapps/schedules/templates/schedules/edx_ace/recurringnudge_day3/email/body.html
@@ -1,4 +1,4 @@
-{% extends 'schedules/edx_ace/common/base_body.html' %}
+{% extends 'ace_common/edx_ace/common/base_body.html' %}
{% load i18n %}
{% block preview_text %}
@@ -36,9 +36,9 @@
{% trans "Start learning now" as course_cta_text %}
- {% include "schedules/edx_ace/common/return_to_course_cta.html" with course_cta_text=course_cta_text%}
+ {% include "ace_common/edx_ace/common/return_to_course_cta.html" with course_cta_text=course_cta_text%}
- {% include "schedules/edx_ace/common/upsell_cta.html"%}
+ {% include "ace_common/edx_ace/common/upsell_cta.html"%}
diff --git a/openedx/core/djangoapps/schedules/templates/schedules/edx_ace/recurringnudge_day3/email/body.txt b/openedx/core/djangoapps/schedules/templates/schedules/edx_ace/recurringnudge_day3/email/body.txt
index 1931edefec..fdf8f8be47 100644
--- a/openedx/core/djangoapps/schedules/templates/schedules/edx_ace/recurringnudge_day3/email/body.txt
+++ b/openedx/core/djangoapps/schedules/templates/schedules/edx_ace/recurringnudge_day3/email/body.txt
@@ -16,5 +16,5 @@
{% trans "Start learning now" %} <{% with_link_tracking course_url %}>
{% endif %}
-{% include "schedules/edx_ace/common/upsell_cta.txt"%}
+{% include "ace_common/edx_ace/common/upsell_cta.txt"%}
{% endautoescape %}
diff --git a/openedx/core/djangoapps/schedules/templates/schedules/edx_ace/recurringnudge_day3/email/head.html b/openedx/core/djangoapps/schedules/templates/schedules/edx_ace/recurringnudge_day3/email/head.html
index 588357ec65..366ada7ad9 100644
--- a/openedx/core/djangoapps/schedules/templates/schedules/edx_ace/recurringnudge_day3/email/head.html
+++ b/openedx/core/djangoapps/schedules/templates/schedules/edx_ace/recurringnudge_day3/email/head.html
@@ -1 +1 @@
-{% extends 'schedules/edx_ace/common/base_head.html' %}
+{% extends 'ace_common/edx_ace/common/base_head.html' %}
diff --git a/openedx/core/djangoapps/schedules/templates/schedules/edx_ace/upgradereminder/email/body.html b/openedx/core/djangoapps/schedules/templates/schedules/edx_ace/upgradereminder/email/body.html
index 5c1af75a7a..2b42a50de1 100644
--- a/openedx/core/djangoapps/schedules/templates/schedules/edx_ace/upgradereminder/email/body.html
+++ b/openedx/core/djangoapps/schedules/templates/schedules/edx_ace/upgradereminder/email/body.html
@@ -1,4 +1,4 @@
-{% extends 'schedules/edx_ace/common/base_body.html' %}
+{% extends 'ace_common/edx_ace/common/base_body.html' %}
{% load i18n %}
{% load static %}
{% load ace %}
diff --git a/openedx/core/djangoapps/schedules/templates/schedules/edx_ace/upgradereminder/email/head.html b/openedx/core/djangoapps/schedules/templates/schedules/edx_ace/upgradereminder/email/head.html
index 588357ec65..366ada7ad9 100644
--- a/openedx/core/djangoapps/schedules/templates/schedules/edx_ace/upgradereminder/email/head.html
+++ b/openedx/core/djangoapps/schedules/templates/schedules/edx_ace/upgradereminder/email/head.html
@@ -1 +1 @@
-{% extends 'schedules/edx_ace/common/base_head.html' %}
+{% extends 'ace_common/edx_ace/common/base_head.html' %}
diff --git a/themes/red-theme/lms/templates/schedules/edx_ace/common/base_body.html b/themes/red-theme/lms/templates/ace_common/edx_ace/common/base_body.html
similarity index 100%
rename from themes/red-theme/lms/templates/schedules/edx_ace/common/base_body.html
rename to themes/red-theme/lms/templates/ace_common/edx_ace/common/base_body.html
diff --git a/themes/red-theme/lms/templates/schedules/edx_ace/common/return_to_course_cta.html b/themes/red-theme/lms/templates/ace_common/edx_ace/common/return_to_course_cta.html
similarity index 100%
rename from themes/red-theme/lms/templates/schedules/edx_ace/common/return_to_course_cta.html
rename to themes/red-theme/lms/templates/ace_common/edx_ace/common/return_to_course_cta.html
diff --git a/themes/red-theme/lms/templates/schedules/edx_ace/recurringnudge_day3/email/body.txt b/themes/red-theme/lms/templates/schedules/edx_ace/recurringnudge_day3/email/body.txt
index 19b5365f08..3354bbdaae 100644
--- a/themes/red-theme/lms/templates/schedules/edx_ace/recurringnudge_day3/email/body.txt
+++ b/themes/red-theme/lms/templates/schedules/edx_ace/recurringnudge_day3/email/body.txt
@@ -17,4 +17,4 @@ This is the RED theme!
{% trans "Start learning now" %} <{% with_link_tracking course_url %}>
{% endif %}
-{% include "schedules/edx_ace/common/upsell_cta.txt"%}
+{% include "ace_common/edx_ace/common/upsell_cta.txt"%}
From 7245f7696e185505a47b46dc2c0ac6cd8f34b9f5 Mon Sep 17 00:00:00 2001
From: Nimisha Asthagiri
Date: Mon, 4 Dec 2017 20:48:30 -0500
Subject: [PATCH 3/3] Fix quality issues in ace_common
---
openedx/core/djangoapps/ace_common/__init__.py | 6 +++++-
openedx/core/djangoapps/ace_common/apps.py | 6 ++++++
.../core/djangoapps/ace_common/template_context.py | 13 +++++++++++--
.../core/djangoapps/ace_common/templatetags/ace.py | 5 +++--
openedx/core/djangoapps/ace_common/tests/mixins.py | 1 +
.../ace_common/tests/test_templatetags.py | 2 ++
.../djangoapps/ace_common/tests/test_tracking.py | 1 +
openedx/core/djangoapps/ace_common/tracking.py | 6 +++++-
8 files changed, 34 insertions(+), 6 deletions(-)
diff --git a/openedx/core/djangoapps/ace_common/__init__.py b/openedx/core/djangoapps/ace_common/__init__.py
index af927a92b1..8d5975ff6d 100644
--- a/openedx/core/djangoapps/ace_common/__init__.py
+++ b/openedx/core/djangoapps/ace_common/__init__.py
@@ -1 +1,5 @@
-default_app_config = 'openedx.core.djangoapps.ace_common.apps.AceCommonConfig'
+"""
+ace_common is a Django App that provides common utilities and templates
+for edx-platform applications that use ACE as their messaging framework.
+"""
+default_app_config = 'openedx.core.djangoapps.ace_common.apps.AceCommonConfig' # pylint: disable=invalid-name
diff --git a/openedx/core/djangoapps/ace_common/apps.py b/openedx/core/djangoapps/ace_common/apps.py
index 96ba22cd0f..0527b125ea 100644
--- a/openedx/core/djangoapps/ace_common/apps.py
+++ b/openedx/core/djangoapps/ace_common/apps.py
@@ -1,7 +1,13 @@
+"""
+Configuration for the ace_common Django app.
+"""
from django.apps import AppConfig
from django.utils.translation import ugettext_lazy as _
class AceCommonConfig(AppConfig):
+ """
+ Configuration class for the ace_common Django app.
+ """
name = 'openedx.core.djangoapps.ace_common'
verbose_name = _('ACE Common')
diff --git a/openedx/core/djangoapps/ace_common/template_context.py b/openedx/core/djangoapps/ace_common/template_context.py
index 8880e29511..b86658fb1f 100644
--- a/openedx/core/djangoapps/ace_common/template_context.py
+++ b/openedx/core/djangoapps/ace_common/template_context.py
@@ -1,3 +1,6 @@
+"""
+Context dictionary for templates that use the ace_common base template.
+"""
from django.conf import settings
from django.core.urlresolvers import reverse
@@ -6,13 +9,19 @@ from openedx.core.djangoapps.theming.helpers import get_config_value_from_site_o
def get_base_template_context(site):
- """Dict with entries needed for all templates that use the base template"""
+ """
+ Dict with entries needed for all templates that use the base template.
+ """
return {
# Platform information
'homepage_url': marketing_link('ROOT'),
'dashboard_url': reverse('dashboard'),
'template_revision': getattr(settings, 'EDX_PLATFORM_REVISION', None),
- 'platform_name': get_config_value_from_site_or_settings('PLATFORM_NAME', site=site, site_config_name='platform_name'),
+ 'platform_name': get_config_value_from_site_or_settings(
+ 'PLATFORM_NAME',
+ site=site,
+ site_config_name='platform_name',
+ ),
'contact_mailing_address': get_config_value_from_site_or_settings(
'CONTACT_MAILING_ADDRESS', site=site, site_config_name='contact_mailing_address'),
'social_media_urls': get_config_value_from_site_or_settings('SOCIAL_MEDIA_FOOTER_URLS', site=site),
diff --git a/openedx/core/djangoapps/ace_common/templatetags/ace.py b/openedx/core/djangoapps/ace_common/templatetags/ace.py
index c9b6975ae4..b84fde3684 100644
--- a/openedx/core/djangoapps/ace_common/templatetags/ace.py
+++ b/openedx/core/djangoapps/ace_common/templatetags/ace.py
@@ -1,3 +1,4 @@
+# pylint: disable=missing-docstring
from urlparse import urlparse
from crum import get_current_request
@@ -7,7 +8,7 @@ from django.utils.safestring import mark_safe
from openedx.core.djangoapps.ace_common.tracking import CampaignTrackingInfo, GoogleAnalyticsTrackingPixel
from openedx.core.djangolib.markup import HTML
-register = template.Library()
+register = template.Library() # pylint: disable=invalid-name
@register.simple_tag(takes_context=True)
@@ -133,7 +134,7 @@ def modify_url_to_track_clicks(url, campaign=None):
if campaign is None:
campaign = CampaignTrackingInfo()
modified_url = parsed_url._replace(query=campaign.to_query_string(parsed_url.query))
- return modified_url.geturl()
+ return modified_url.geturl() # pylint: disable=no-member
def ensure_url_is_absolute(site, relative_path):
diff --git a/openedx/core/djangoapps/ace_common/tests/mixins.py b/openedx/core/djangoapps/ace_common/tests/mixins.py
index e738743b94..c3e01f7808 100644
--- a/openedx/core/djangoapps/ace_common/tests/mixins.py
+++ b/openedx/core/djangoapps/ace_common/tests/mixins.py
@@ -1,3 +1,4 @@
+# pylint: disable=missing-docstring
from urlparse import parse_qs, urlparse
diff --git a/openedx/core/djangoapps/ace_common/tests/test_templatetags.py b/openedx/core/djangoapps/ace_common/tests/test_templatetags.py
index a517068cd8..cbbef0266f 100644
--- a/openedx/core/djangoapps/ace_common/tests/test_templatetags.py
+++ b/openedx/core/djangoapps/ace_common/tests/test_templatetags.py
@@ -1,3 +1,4 @@
+# pylint: disable=missing-docstring,no-member
import uuid
from django.http import HttpRequest
@@ -23,6 +24,7 @@ class TestAbsoluteUrl(CacheIsolationTestCase):
def setUp(self):
self.site = SiteFactory.create()
self.site.domain = 'example.com'
+ super(TestAbsoluteUrl, self).setUp()
def test_absolute_url(self):
absolute = ensure_url_is_absolute(self.site, '/foo/bar')
diff --git a/openedx/core/djangoapps/ace_common/tests/test_tracking.py b/openedx/core/djangoapps/ace_common/tests/test_tracking.py
index e734f9f739..4de7e17fe7 100644
--- a/openedx/core/djangoapps/ace_common/tests/test_tracking.py
+++ b/openedx/core/djangoapps/ace_common/tests/test_tracking.py
@@ -1,3 +1,4 @@
+# pylint: disable=missing-docstring,no-member
from unittest import TestCase
from django.test import override_settings
diff --git a/openedx/core/djangoapps/ace_common/tracking.py b/openedx/core/djangoapps/ace_common/tracking.py
index 907302cb4f..14b978a5cc 100644
--- a/openedx/core/djangoapps/ace_common/tracking.py
+++ b/openedx/core/djangoapps/ace_common/tracking.py
@@ -1,3 +1,4 @@
+# pylint: disable=missing-docstring
from urlparse import parse_qs
import attr
@@ -92,7 +93,10 @@ class GoogleAnalyticsTrackingPixel(object):
parameters['tid'] = tracking_id
- user_id_dimension = get_config_value_from_site_or_settings("GOOGLE_ANALYTICS_USER_ID_CUSTOM_DIMENSION", site=self.site)
+ user_id_dimension = get_config_value_from_site_or_settings(
+ "GOOGLE_ANALYTICS_USER_ID_CUSTOM_DIMENSION",
+ site=self.site,
+ )
if user_id_dimension is not None and self.user_id is not None:
parameter_name = 'cd{0}'.format(user_id_dimension)
parameters[parameter_name] = self.user_id