diff --git a/common/test/test_microsites/test_microsite/templates/static_templates/copyright.html b/common/test/test_microsites/test_microsite/templates/static_templates/copyright.html new file mode 100755 index 0000000000..d24c6dab67 --- /dev/null +++ b/common/test/test_microsites/test_microsite/templates/static_templates/copyright.html @@ -0,0 +1 @@ +This is a copyright page for an Open edX microsite. diff --git a/lms/djangoapps/courseware/tests/test_microsites.py b/lms/djangoapps/courseware/tests/test_microsites.py index 849ef224a1..302d09898d 100644 --- a/lms/djangoapps/courseware/tests/test_microsites.py +++ b/lms/djangoapps/courseware/tests/test_microsites.py @@ -142,6 +142,26 @@ class TestMicrosites(ModuleStoreTestCase, LoginEnrollmentTestCase): # assert that footer template has been properly overriden on homepage self.assertNotContains(resp, 'This is a Test Microsite footer') + @override_settings(SITE_NAME=settings.MICROSITE_TEST_HOSTNAME) + def test_microsite_anonymous_copyright_content(self): + """ + Verify that the copyright, when accessed via a Microsite domain, returns + the expected 200 response + """ + + resp = self.client.get('/copyright', HTTP_HOST=settings.MICROSITE_TEST_HOSTNAME) + self.assertEqual(resp.status_code, 200) + + self.assertContains(resp, 'This is a copyright page for an Open edX microsite.') + + def test_not_microsite_anonymous_copyright_content(self): + """ + Verify that the copyright page does not exist if we are not in a microsite + """ + + resp = self.client.get('/copyright') + self.assertEqual(resp.status_code, 404) + def test_no_redirect_on_homepage_when_no_enrollments(self): """ Verify that a user going to homepage will not redirect if he/she has no course enrollments diff --git a/lms/djangoapps/static_template_view/views.py b/lms/djangoapps/static_template_view/views.py index 6b51029a93..3873a64d93 100644 --- a/lms/djangoapps/static_template_view/views.py +++ b/lms/djangoapps/static_template_view/views.py @@ -45,7 +45,10 @@ def render(request, template): # Guess content type from file extension content_type, __ = mimetypes.guess_type(template) - return render_to_response('static_templates/' + template, {}, content_type=content_type) + try: + return render_to_response('static_templates/' + template, {}, content_type=content_type) + except TopLevelLookupException: + raise Http404 @ensure_csrf_cookie diff --git a/lms/templates/static_templates/copyright.html b/lms/templates/static_templates/copyright.html deleted file mode 100644 index f4e02ee079..0000000000 --- a/lms/templates/static_templates/copyright.html +++ /dev/null @@ -1,9 +0,0 @@ -<%! from django.utils.translation import ugettext as _ %> -<%inherit file="../main.html" /> - -<%block name="pagetitle">${_("Copyright")} - -
-

${_("Copyright")}

-

${_("This page left intentionally blank. It is not used by edx.org but is left here for possible use by installations of Open edX.")}

-
diff --git a/lms/urls.py b/lms/urls.py index 0b18df4622..b6096c152f 100644 --- a/lms/urls.py +++ b/lms/urls.py @@ -186,8 +186,6 @@ if not settings.FEATURES["USE_CUSTOM_THEME"]: {'template': 'press.html'}, name="press"), url(r'^media-kit$', 'static_template_view.views.render', {'template': 'media-kit.html'}, name="media-kit"), - - # TODO: (bridger) The copyright has been removed until it is updated for edX url(r'^copyright$', 'static_template_view.views.render', {'template': 'copyright.html'}, name="copyright"),