From 6ddff7fcb3360cd6c61d6c8fd73cf13088bf083e Mon Sep 17 00:00:00 2001 From: Your Name Date: Wed, 20 Mar 2013 09:04:14 -0400 Subject: [PATCH 01/13] stash merge --- lms/djangoapps/django_comment_client/forum/views.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lms/djangoapps/django_comment_client/forum/views.py b/lms/djangoapps/django_comment_client/forum/views.py index 3eee0948da..2c4c218ba5 100644 --- a/lms/djangoapps/django_comment_client/forum/views.py +++ b/lms/djangoapps/django_comment_client/forum/views.py @@ -239,7 +239,10 @@ def forum_form_discussion(request, course_id): 'is_course_cohorted': is_course_cohorted(course_id) } # print "start rendering.." +<<<<<<< Updated upstream +======= +>>>>>>> Stashed changes return render_to_response('discussion/index.html', context) @login_required From 9964e4c2bbda679f4d5dee977ed5101972c02751 Mon Sep 17 00:00:00 2001 From: Your Name Date: Wed, 20 Mar 2013 09:16:26 -0400 Subject: [PATCH 02/13] local fix to merge conflict --- lms/djangoapps/django_comment_client/forum/views.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/lms/djangoapps/django_comment_client/forum/views.py b/lms/djangoapps/django_comment_client/forum/views.py index 2c4c218ba5..c9fdda7a2e 100644 --- a/lms/djangoapps/django_comment_client/forum/views.py +++ b/lms/djangoapps/django_comment_client/forum/views.py @@ -239,10 +239,6 @@ def forum_form_discussion(request, course_id): 'is_course_cohorted': is_course_cohorted(course_id) } # print "start rendering.." -<<<<<<< Updated upstream - -======= ->>>>>>> Stashed changes return render_to_response('discussion/index.html', context) @login_required From b118b731434f845489e2ab1a5261df8c2979d467 Mon Sep 17 00:00:00 2001 From: Sef Kloninger Date: Wed, 10 Apr 2013 01:19:20 -0400 Subject: [PATCH 03/13] press releases: standardize template names (move 1) --- .../{bostonx_announcement.html => foo-bostonx_announcement.html} | 0 ...book_content.html => foo-cengage_to_provide_book_content.html} | 0 ...testing.html => foo-edx_announces_proctored_exam_testing.html} | 0 ..._internationally.html => foo-edx_expands_internationally.html} | 0 ...ates_with_edX.html => foo-elsevier_collaborates_with_edx.html} | 0 ...er_secret_of_life.html => foo-eric_lander_secret_of_life.html} | 0 ...n_announcement.html => foo-gates_foundation_announcement.html} | 0 .../{Georgetown_joins_edX.html => foo-georgetown_joins_edx.html} | 0 ...ourse_announcement.html => foo-lewin_course_announcement.html} | 0 ...rd_announce_edX.html => foo-mit_and_harvard_announce_edx.html} | 0 ...ing_2013_course_announcements.html => foo-spring_courses.html} | 0 ...nford_announcement.html => foo-stanford_to_work_with_edx.html} | 0 .../press_releases/{template.html => foo-template.html} | 0 ...{UC_Berkeley_joins_edX.html => foo-uc_berkeley_joins_edx.html} | 0 .../press_releases/{UT_joins_edX.html => foo-ut_joins_edx.html} | 0 ...ollege_joins_edX.html => foo-wellesley_college_joins_edx.html} | 0 .../{xblock_announcement.html => foo-xblock_announcement.html} | 0 17 files changed, 0 insertions(+), 0 deletions(-) rename lms/templates/static_templates/press_releases/{bostonx_announcement.html => foo-bostonx_announcement.html} (100%) rename lms/templates/static_templates/press_releases/{Cengage_to_provide_book_content.html => foo-cengage_to_provide_book_content.html} (100%) rename lms/templates/static_templates/press_releases/{edX_announces_proctored_exam_testing.html => foo-edx_announces_proctored_exam_testing.html} (100%) rename lms/templates/static_templates/press_releases/{edx_expands_internationally.html => foo-edx_expands_internationally.html} (100%) rename lms/templates/static_templates/press_releases/{Elsevier_collaborates_with_edX.html => foo-elsevier_collaborates_with_edx.html} (100%) rename lms/templates/static_templates/press_releases/{eric_lander_secret_of_life.html => foo-eric_lander_secret_of_life.html} (100%) rename lms/templates/static_templates/press_releases/{Gates_Foundation_announcement.html => foo-gates_foundation_announcement.html} (100%) rename lms/templates/static_templates/press_releases/{Georgetown_joins_edX.html => foo-georgetown_joins_edx.html} (100%) rename lms/templates/static_templates/press_releases/{Lewin_course_announcement.html => foo-lewin_course_announcement.html} (100%) rename lms/templates/static_templates/press_releases/{MIT_and_Harvard_announce_edX.html => foo-mit_and_harvard_announce_edx.html} (100%) rename lms/templates/static_templates/press_releases/{Spring_2013_course_announcements.html => foo-spring_courses.html} (100%) rename lms/templates/static_templates/press_releases/{stanford_announcement.html => foo-stanford_to_work_with_edx.html} (100%) rename lms/templates/static_templates/press_releases/{template.html => foo-template.html} (100%) rename lms/templates/static_templates/press_releases/{UC_Berkeley_joins_edX.html => foo-uc_berkeley_joins_edx.html} (100%) rename lms/templates/static_templates/press_releases/{UT_joins_edX.html => foo-ut_joins_edx.html} (100%) rename lms/templates/static_templates/press_releases/{Wellesley_College_joins_edX.html => foo-wellesley_college_joins_edx.html} (100%) rename lms/templates/static_templates/press_releases/{xblock_announcement.html => foo-xblock_announcement.html} (100%) diff --git a/lms/templates/static_templates/press_releases/bostonx_announcement.html b/lms/templates/static_templates/press_releases/foo-bostonx_announcement.html similarity index 100% rename from lms/templates/static_templates/press_releases/bostonx_announcement.html rename to lms/templates/static_templates/press_releases/foo-bostonx_announcement.html diff --git a/lms/templates/static_templates/press_releases/Cengage_to_provide_book_content.html b/lms/templates/static_templates/press_releases/foo-cengage_to_provide_book_content.html similarity index 100% rename from lms/templates/static_templates/press_releases/Cengage_to_provide_book_content.html rename to lms/templates/static_templates/press_releases/foo-cengage_to_provide_book_content.html diff --git a/lms/templates/static_templates/press_releases/edX_announces_proctored_exam_testing.html b/lms/templates/static_templates/press_releases/foo-edx_announces_proctored_exam_testing.html similarity index 100% rename from lms/templates/static_templates/press_releases/edX_announces_proctored_exam_testing.html rename to lms/templates/static_templates/press_releases/foo-edx_announces_proctored_exam_testing.html diff --git a/lms/templates/static_templates/press_releases/edx_expands_internationally.html b/lms/templates/static_templates/press_releases/foo-edx_expands_internationally.html similarity index 100% rename from lms/templates/static_templates/press_releases/edx_expands_internationally.html rename to lms/templates/static_templates/press_releases/foo-edx_expands_internationally.html diff --git a/lms/templates/static_templates/press_releases/Elsevier_collaborates_with_edX.html b/lms/templates/static_templates/press_releases/foo-elsevier_collaborates_with_edx.html similarity index 100% rename from lms/templates/static_templates/press_releases/Elsevier_collaborates_with_edX.html rename to lms/templates/static_templates/press_releases/foo-elsevier_collaborates_with_edx.html diff --git a/lms/templates/static_templates/press_releases/eric_lander_secret_of_life.html b/lms/templates/static_templates/press_releases/foo-eric_lander_secret_of_life.html similarity index 100% rename from lms/templates/static_templates/press_releases/eric_lander_secret_of_life.html rename to lms/templates/static_templates/press_releases/foo-eric_lander_secret_of_life.html diff --git a/lms/templates/static_templates/press_releases/Gates_Foundation_announcement.html b/lms/templates/static_templates/press_releases/foo-gates_foundation_announcement.html similarity index 100% rename from lms/templates/static_templates/press_releases/Gates_Foundation_announcement.html rename to lms/templates/static_templates/press_releases/foo-gates_foundation_announcement.html diff --git a/lms/templates/static_templates/press_releases/Georgetown_joins_edX.html b/lms/templates/static_templates/press_releases/foo-georgetown_joins_edx.html similarity index 100% rename from lms/templates/static_templates/press_releases/Georgetown_joins_edX.html rename to lms/templates/static_templates/press_releases/foo-georgetown_joins_edx.html diff --git a/lms/templates/static_templates/press_releases/Lewin_course_announcement.html b/lms/templates/static_templates/press_releases/foo-lewin_course_announcement.html similarity index 100% rename from lms/templates/static_templates/press_releases/Lewin_course_announcement.html rename to lms/templates/static_templates/press_releases/foo-lewin_course_announcement.html diff --git a/lms/templates/static_templates/press_releases/MIT_and_Harvard_announce_edX.html b/lms/templates/static_templates/press_releases/foo-mit_and_harvard_announce_edx.html similarity index 100% rename from lms/templates/static_templates/press_releases/MIT_and_Harvard_announce_edX.html rename to lms/templates/static_templates/press_releases/foo-mit_and_harvard_announce_edx.html diff --git a/lms/templates/static_templates/press_releases/Spring_2013_course_announcements.html b/lms/templates/static_templates/press_releases/foo-spring_courses.html similarity index 100% rename from lms/templates/static_templates/press_releases/Spring_2013_course_announcements.html rename to lms/templates/static_templates/press_releases/foo-spring_courses.html diff --git a/lms/templates/static_templates/press_releases/stanford_announcement.html b/lms/templates/static_templates/press_releases/foo-stanford_to_work_with_edx.html similarity index 100% rename from lms/templates/static_templates/press_releases/stanford_announcement.html rename to lms/templates/static_templates/press_releases/foo-stanford_to_work_with_edx.html diff --git a/lms/templates/static_templates/press_releases/template.html b/lms/templates/static_templates/press_releases/foo-template.html similarity index 100% rename from lms/templates/static_templates/press_releases/template.html rename to lms/templates/static_templates/press_releases/foo-template.html diff --git a/lms/templates/static_templates/press_releases/UC_Berkeley_joins_edX.html b/lms/templates/static_templates/press_releases/foo-uc_berkeley_joins_edx.html similarity index 100% rename from lms/templates/static_templates/press_releases/UC_Berkeley_joins_edX.html rename to lms/templates/static_templates/press_releases/foo-uc_berkeley_joins_edx.html diff --git a/lms/templates/static_templates/press_releases/UT_joins_edX.html b/lms/templates/static_templates/press_releases/foo-ut_joins_edx.html similarity index 100% rename from lms/templates/static_templates/press_releases/UT_joins_edX.html rename to lms/templates/static_templates/press_releases/foo-ut_joins_edx.html diff --git a/lms/templates/static_templates/press_releases/Wellesley_College_joins_edX.html b/lms/templates/static_templates/press_releases/foo-wellesley_college_joins_edx.html similarity index 100% rename from lms/templates/static_templates/press_releases/Wellesley_College_joins_edX.html rename to lms/templates/static_templates/press_releases/foo-wellesley_college_joins_edx.html diff --git a/lms/templates/static_templates/press_releases/xblock_announcement.html b/lms/templates/static_templates/press_releases/foo-xblock_announcement.html similarity index 100% rename from lms/templates/static_templates/press_releases/xblock_announcement.html rename to lms/templates/static_templates/press_releases/foo-xblock_announcement.html From f57028b8e8118c56a161fd380f1478d14d461e58 Mon Sep 17 00:00:00 2001 From: Sef Kloninger Date: Wed, 10 Apr 2013 01:23:32 -0400 Subject: [PATCH 04/13] press releases: standardize template names (move 2) --- .../{foo-bostonx_announcement.html => bostonx_announcement.html} | 0 ...ide_book_content.html => cengage_to_provide_book_content.html} | 0 ...xam_testing.html => edx_announces_proctored_exam_testing.html} | 0 ...ands_internationally.html => edx_expands_internationally.html} | 0 ...aborates_with_edx.html => elsevier_collaborates_with_edx.html} | 0 ...lander_secret_of_life.html => eric_lander_secret_of_life.html} | 0 ...ation_announcement.html => gates_foundation_announcement.html} | 0 .../{foo-georgetown_joins_edx.html => georgetown_joins_edx.html} | 0 ...in_course_announcement.html => lewin_course_announcement.html} | 0 ...arvard_announce_edx.html => mit_and_harvard_announce_edx.html} | 0 .../{foo-spring_courses.html => spring_courses.html} | 0 ...nford_to_work_with_edx.html => stanford_to_work_with_edx.html} | 0 .../press_releases/{foo-template.html => template.html} | 0 ...{foo-uc_berkeley_joins_edx.html => uc_berkeley_joins_edx.html} | 0 .../press_releases/{foo-ut_joins_edx.html => ut_joins_edx.html} | 0 ...ey_college_joins_edx.html => wellesley_college_joins_edx.html} | 0 .../{foo-xblock_announcement.html => xblock_announcement.html} | 0 17 files changed, 0 insertions(+), 0 deletions(-) rename lms/templates/static_templates/press_releases/{foo-bostonx_announcement.html => bostonx_announcement.html} (100%) rename lms/templates/static_templates/press_releases/{foo-cengage_to_provide_book_content.html => cengage_to_provide_book_content.html} (100%) rename lms/templates/static_templates/press_releases/{foo-edx_announces_proctored_exam_testing.html => edx_announces_proctored_exam_testing.html} (100%) rename lms/templates/static_templates/press_releases/{foo-edx_expands_internationally.html => edx_expands_internationally.html} (100%) rename lms/templates/static_templates/press_releases/{foo-elsevier_collaborates_with_edx.html => elsevier_collaborates_with_edx.html} (100%) rename lms/templates/static_templates/press_releases/{foo-eric_lander_secret_of_life.html => eric_lander_secret_of_life.html} (100%) rename lms/templates/static_templates/press_releases/{foo-gates_foundation_announcement.html => gates_foundation_announcement.html} (100%) rename lms/templates/static_templates/press_releases/{foo-georgetown_joins_edx.html => georgetown_joins_edx.html} (100%) rename lms/templates/static_templates/press_releases/{foo-lewin_course_announcement.html => lewin_course_announcement.html} (100%) rename lms/templates/static_templates/press_releases/{foo-mit_and_harvard_announce_edx.html => mit_and_harvard_announce_edx.html} (100%) rename lms/templates/static_templates/press_releases/{foo-spring_courses.html => spring_courses.html} (100%) rename lms/templates/static_templates/press_releases/{foo-stanford_to_work_with_edx.html => stanford_to_work_with_edx.html} (100%) rename lms/templates/static_templates/press_releases/{foo-template.html => template.html} (100%) rename lms/templates/static_templates/press_releases/{foo-uc_berkeley_joins_edx.html => uc_berkeley_joins_edx.html} (100%) rename lms/templates/static_templates/press_releases/{foo-ut_joins_edx.html => ut_joins_edx.html} (100%) rename lms/templates/static_templates/press_releases/{foo-wellesley_college_joins_edx.html => wellesley_college_joins_edx.html} (100%) rename lms/templates/static_templates/press_releases/{foo-xblock_announcement.html => xblock_announcement.html} (100%) diff --git a/lms/templates/static_templates/press_releases/foo-bostonx_announcement.html b/lms/templates/static_templates/press_releases/bostonx_announcement.html similarity index 100% rename from lms/templates/static_templates/press_releases/foo-bostonx_announcement.html rename to lms/templates/static_templates/press_releases/bostonx_announcement.html diff --git a/lms/templates/static_templates/press_releases/foo-cengage_to_provide_book_content.html b/lms/templates/static_templates/press_releases/cengage_to_provide_book_content.html similarity index 100% rename from lms/templates/static_templates/press_releases/foo-cengage_to_provide_book_content.html rename to lms/templates/static_templates/press_releases/cengage_to_provide_book_content.html diff --git a/lms/templates/static_templates/press_releases/foo-edx_announces_proctored_exam_testing.html b/lms/templates/static_templates/press_releases/edx_announces_proctored_exam_testing.html similarity index 100% rename from lms/templates/static_templates/press_releases/foo-edx_announces_proctored_exam_testing.html rename to lms/templates/static_templates/press_releases/edx_announces_proctored_exam_testing.html diff --git a/lms/templates/static_templates/press_releases/foo-edx_expands_internationally.html b/lms/templates/static_templates/press_releases/edx_expands_internationally.html similarity index 100% rename from lms/templates/static_templates/press_releases/foo-edx_expands_internationally.html rename to lms/templates/static_templates/press_releases/edx_expands_internationally.html diff --git a/lms/templates/static_templates/press_releases/foo-elsevier_collaborates_with_edx.html b/lms/templates/static_templates/press_releases/elsevier_collaborates_with_edx.html similarity index 100% rename from lms/templates/static_templates/press_releases/foo-elsevier_collaborates_with_edx.html rename to lms/templates/static_templates/press_releases/elsevier_collaborates_with_edx.html diff --git a/lms/templates/static_templates/press_releases/foo-eric_lander_secret_of_life.html b/lms/templates/static_templates/press_releases/eric_lander_secret_of_life.html similarity index 100% rename from lms/templates/static_templates/press_releases/foo-eric_lander_secret_of_life.html rename to lms/templates/static_templates/press_releases/eric_lander_secret_of_life.html diff --git a/lms/templates/static_templates/press_releases/foo-gates_foundation_announcement.html b/lms/templates/static_templates/press_releases/gates_foundation_announcement.html similarity index 100% rename from lms/templates/static_templates/press_releases/foo-gates_foundation_announcement.html rename to lms/templates/static_templates/press_releases/gates_foundation_announcement.html diff --git a/lms/templates/static_templates/press_releases/foo-georgetown_joins_edx.html b/lms/templates/static_templates/press_releases/georgetown_joins_edx.html similarity index 100% rename from lms/templates/static_templates/press_releases/foo-georgetown_joins_edx.html rename to lms/templates/static_templates/press_releases/georgetown_joins_edx.html diff --git a/lms/templates/static_templates/press_releases/foo-lewin_course_announcement.html b/lms/templates/static_templates/press_releases/lewin_course_announcement.html similarity index 100% rename from lms/templates/static_templates/press_releases/foo-lewin_course_announcement.html rename to lms/templates/static_templates/press_releases/lewin_course_announcement.html diff --git a/lms/templates/static_templates/press_releases/foo-mit_and_harvard_announce_edx.html b/lms/templates/static_templates/press_releases/mit_and_harvard_announce_edx.html similarity index 100% rename from lms/templates/static_templates/press_releases/foo-mit_and_harvard_announce_edx.html rename to lms/templates/static_templates/press_releases/mit_and_harvard_announce_edx.html diff --git a/lms/templates/static_templates/press_releases/foo-spring_courses.html b/lms/templates/static_templates/press_releases/spring_courses.html similarity index 100% rename from lms/templates/static_templates/press_releases/foo-spring_courses.html rename to lms/templates/static_templates/press_releases/spring_courses.html diff --git a/lms/templates/static_templates/press_releases/foo-stanford_to_work_with_edx.html b/lms/templates/static_templates/press_releases/stanford_to_work_with_edx.html similarity index 100% rename from lms/templates/static_templates/press_releases/foo-stanford_to_work_with_edx.html rename to lms/templates/static_templates/press_releases/stanford_to_work_with_edx.html diff --git a/lms/templates/static_templates/press_releases/foo-template.html b/lms/templates/static_templates/press_releases/template.html similarity index 100% rename from lms/templates/static_templates/press_releases/foo-template.html rename to lms/templates/static_templates/press_releases/template.html diff --git a/lms/templates/static_templates/press_releases/foo-uc_berkeley_joins_edx.html b/lms/templates/static_templates/press_releases/uc_berkeley_joins_edx.html similarity index 100% rename from lms/templates/static_templates/press_releases/foo-uc_berkeley_joins_edx.html rename to lms/templates/static_templates/press_releases/uc_berkeley_joins_edx.html diff --git a/lms/templates/static_templates/press_releases/foo-ut_joins_edx.html b/lms/templates/static_templates/press_releases/ut_joins_edx.html similarity index 100% rename from lms/templates/static_templates/press_releases/foo-ut_joins_edx.html rename to lms/templates/static_templates/press_releases/ut_joins_edx.html diff --git a/lms/templates/static_templates/press_releases/foo-wellesley_college_joins_edx.html b/lms/templates/static_templates/press_releases/wellesley_college_joins_edx.html similarity index 100% rename from lms/templates/static_templates/press_releases/foo-wellesley_college_joins_edx.html rename to lms/templates/static_templates/press_releases/wellesley_college_joins_edx.html diff --git a/lms/templates/static_templates/press_releases/foo-xblock_announcement.html b/lms/templates/static_templates/press_releases/xblock_announcement.html similarity index 100% rename from lms/templates/static_templates/press_releases/foo-xblock_announcement.html rename to lms/templates/static_templates/press_releases/xblock_announcement.html From 4b68e0282f4936a03f0d7705f9b16c31ce2d2cab Mon Sep 17 00:00:00 2001 From: Sef Kloninger Date: Wed, 10 Apr 2013 02:16:35 -0400 Subject: [PATCH 05/13] press releases: use generic matching rule This way instead of having to explicitly add releases to the urls.py file, we just add the relase to the static_templates/press_releases directory and the right thing happens. Getting rid of the current "feature" where /pressrelease redirects to the current press release. It was broken, looks like it's unused. Limitation: release file name must match slug, but with underscores and all lower case. Why bother? I wanted to do something small to learn the edX toolchain. --- lms/djangoapps/static_template_view/tests.py | 57 ++++++++++++++++---- lms/djangoapps/static_template_view/views.py | 22 +++++++- lms/templates/feed.rss | 28 +++++----- lms/urls.py | 46 +--------------- 4 files changed, 84 insertions(+), 69 deletions(-) diff --git a/lms/djangoapps/static_template_view/tests.py b/lms/djangoapps/static_template_view/tests.py index 501deb776c..806242c6d2 100644 --- a/lms/djangoapps/static_template_view/tests.py +++ b/lms/djangoapps/static_template_view/tests.py @@ -1,16 +1,53 @@ -""" -This file demonstrates writing tests using the unittest module. These will pass -when you run "manage.py test". - -Replace this with more appropriate tests for your application. -""" - from django.test import TestCase +from django.test.client import Client class SimpleTest(TestCase): - def test_basic_addition(self): + + def setUp(self): + self.client = Client() + + def test_render(self): """ - Tests that 1 + 1 always equals 2. + Render a normal page, like jobs """ - self.assertEqual(1 + 1, 2) + response = self.client.get("/jobs") + self.assertEquals(response.status_code, 200) + + + def test_render_press_release(self): + """ + Render press releases from generic URL match + """ + # since I had to remap files, pedantically test all press releases + # published to date. Decent positive test while we're at it. + all_releases = ["/press/mit-and-harvard-announce-edx", + "/press/uc-berkeley-joins-edx", + "/press/edX-announces-proctored-exam-testing", + "/press/elsevier-collaborates-with-edx", + "/press/ut-joins-edx", + "/press/cengage-to-provide-book-content", + "/press/gates-foundation-announcement", + "/press/wellesley-college-joins-edx", + "/press/georgetown-joins-edx", + "/press/spring-courses", + "/press/lewin-course-announcement", + "/press/bostonx-announcement", + "/press/eric-lander-secret-of-life", + "/press/edx-expands-internationally", + "/press/xblock_announcement", + "/press/stanford-to-work-with-edx", + ] + + for rel in all_releases: + response = self.client.get(rel) + self.assertNotContains(response, "PAGE NOT FOUND", status_code=200) + + # should work with caps + response = self.client.get("/press/STANFORD-to-work-with-edx") + self.assertContains(response, "Stanford", status_code=200) + + # negative test + response = self.client.get("/press/this-shouldnt-work") + self.assertEqual(response.status_code, 404) + diff --git a/lms/djangoapps/static_template_view/views.py b/lms/djangoapps/static_template_view/views.py index 022f12b148..56a7f32780 100644 --- a/lms/djangoapps/static_template_view/views.py +++ b/lms/djangoapps/static_template_view/views.py @@ -4,9 +4,10 @@ # security reasons. from mitxmako.shortcuts import render_to_response, render_to_string +from mako.exceptions import TopLevelLookupException from django.shortcuts import redirect from django.conf import settings -from django.http import HttpResponseNotFound, HttpResponseServerError +from django.http import HttpResponseNotFound, HttpResponseServerError, Http404 from django_future.csrf import ensure_csrf_cookie from util.cache import cache_if_anonymous @@ -40,6 +41,25 @@ def render(request, template): return render_to_response('static_templates/' + template, {}) +@ensure_csrf_cookie +@cache_if_anonymous +def render_press_release(request, slug): + """ + Render a press release given a slug. Similar to the "render" function above, + but takes a slug and does a basic conversion to convert it to a template file. + a) all lower case, + b) convert dashes to underscores, and + c) appending ".html" + """ + template = slug.lower().replace('-', '_') + ".html" + try: + resp = render_to_response('static_templates/press_releases/' + template, {}) + except TopLevelLookupException: + raise Http404 + else: + return resp + + def render_404(request): return HttpResponseNotFound(render_to_string('static_templates/404.html', {})) diff --git a/lms/templates/feed.rss b/lms/templates/feed.rss index bd97113e33..3878f0d09f 100644 --- a/lms/templates/feed.rss +++ b/lms/templates/feed.rss @@ -11,7 +11,7 @@ tag:www.edx.org,2012:Post/17 2012-12-19T14:00:00-07:00 2012-12-19T14:00:00-07:00 - + Stanford University to Collaborate with edX on Development of Non-Profit Open Source edX Platform <img src="${static.url('images/press/releases/stanford-university_204x114.png')}" /> <p></p> @@ -20,7 +20,7 @@ tag:www.edx.org,2013:Post/16 2013-03-15T10:00:00-07:00 2013-03-15T10:00:00-07:00 - + edX releases XBlock SDK, first step toward open source vision <img src="${static.url('images/press/releases/edx-logo_240x180.png')}" /> <p></p> @@ -38,7 +38,7 @@ - + @@ -47,7 +47,7 @@ tag:www.edx.org,2013:Post/14 2013-01-30T10:00:00-07:00 2013-01-30T10:00:00-07:00 - + New biology course from human genome pioneer Eric Lander <img src="${static.url('images/press/releases/eric-lander_240x180.jpg')}" /> <p></p> @@ -56,7 +56,7 @@ tag:www.edx.org,2013:Post/12 2013-01-22T10:00:00-07:00 2013-01-22T10:00:00-07:00 - + New course from legendary MIT physics professor Walter Lewin <img src="${static.url('images/press/releases/dr-lewin-316_240x180.jpg')}" /> <p></p> @@ -65,7 +65,7 @@ tag:www.edx.org,2013:Post/11 2013-01-29T10:00:00-07:00 2013-01-29T10:00:00-07:00 - + City of Boston and edX partner to establish BostonX to improve educational access for residents <img src="${static.url('images/press/releases/edx-logo_240x180.png')}" /> <p></p> @@ -74,7 +74,7 @@ - + @@ -83,7 +83,7 @@ tag:www.edx.org,2012:Post/9 2012-12-10T14:00:00-07:00 2012-12-10T14:00:00-07:00 - + Georgetown University joins edX <img src="${static.url('images/press/releases/georgetown-seal_240x180.png')}" /> <p>Sixth institution to join global movement in year one</p> @@ -92,7 +92,7 @@ tag:www.edx.org,2012:Post/8 2012-12-04T14:00:00-07:00 2012-12-04T14:00:00-07:00 - + Wellesley College joins edX <img src="${static.url('images/press/releases/wellesley-seal_240x180.png')}" /> <p>First liberal arts college to join edX</p> @@ -101,7 +101,7 @@ tag:www.edx.org,2012:Post/7 2012-11-12T14:00:00-07:00 2012-11-12T14:00:00-07:00 - + edX and Massachusetts Community Colleges join in Gates-Funded educational initiative <img src="${static.url('images/press/releases/mass-seal_240x180.png')}" /> <p></p> @@ -110,7 +110,7 @@ tag:www.edx.org,2012:Post/6 2012-10-15T14:00:00-07:00 2012-10-14T14:00:00-07:00 - + The University of Texas System joins edX <img src="${static.url('images/press/releases/utsys-seal_240x180.png')}" /> <p>Nine universities and six health institutions</p> @@ -119,7 +119,7 @@ - + @@ -128,7 +128,7 @@ tag:www.edx.org,2012:Post/4 2012-09-06T14:00:00-07:00 2012-09-06T14:00:00-07:00 - + edX to offer learners option of taking proctored final exam <img src="${static.url('images/press/releases/diploma_240x180.jpg')}" /> @@ -136,7 +136,7 @@ tag:www.edx.org,2012:Post/3 2012-07-16T14:08:12-07:00 2012-07-16T14:08:12-07:00 - + UC Berkeley joins edX <img src="${static.url('images/press/releases/edx-logo_240x180.png')}" /> <p>edX broadens course offerings</p> diff --git a/lms/urls.py b/lms/urls.py index 4a0608720a..5251330cd8 100644 --- a/lms/urls.py +++ b/lms/urls.py @@ -117,51 +117,9 @@ urlpatterns = ('', {'template': 'honor.html'}, name="honor"), #Press releases - url(r'^press/mit-and-harvard-announce-edx$', 'static_template_view.views.render', - {'template': 'press_releases/MIT_and_Harvard_announce_edX.html'}, name="press/mit-and-harvard-announce-edx"), - url(r'^press/uc-berkeley-joins-edx$', 'static_template_view.views.render', - {'template': 'press_releases/UC_Berkeley_joins_edX.html'}, name="press/uc-berkeley-joins-edx"), - url(r'^press/edX-announces-proctored-exam-testing$', 'static_template_view.views.render', - {'template': 'press_releases/edX_announces_proctored_exam_testing.html'}, name="press/edX-announces-proctored-exam-testing"), - url(r'^press/elsevier-collaborates-with-edx$', 'static_template_view.views.render', - {'template': 'press_releases/Elsevier_collaborates_with_edX.html'}, name="press/elsevier-collaborates-with-edx"), - url(r'^press/ut-joins-edx$', 'static_template_view.views.render', - {'template': 'press_releases/UT_joins_edX.html'}, name="press/ut-joins-edx"), - url(r'^press/cengage-to-provide-book-content$', 'static_template_view.views.render', - {'template': 'press_releases/Cengage_to_provide_book_content.html'}, name="press/cengage-to-provide-book-content"), - url(r'^press/gates-foundation-announcement$', 'static_template_view.views.render', - {'template': 'press_releases/Gates_Foundation_announcement.html'}, name="press/gates-foundation-announcement"), - url(r'^press/wellesley-college-joins-edx$', 'static_template_view.views.render', - {'template': 'press_releases/Wellesley_College_joins_edX.html'}, name="press/wellesley-college-joins-edx"), - url(r'^press/georgetown-joins-edx$', 'static_template_view.views.render', - {'template': 'press_releases/Georgetown_joins_edX.html'}, name="press/georgetown-joins-edx"), - url(r'^press/spring-courses$', 'static_template_view.views.render', - {'template': 'press_releases/Spring_2013_course_announcements.html'}, - name="press/spring-courses"), - url(r'^press/lewin-course-announcement$', 'static_template_view.views.render', - {'template': 'press_releases/Lewin_course_announcement.html'}, - name="press/lewin-course-announcement"), - url(r'^press/bostonx-announcement$', 'static_template_view.views.render', - {'template': 'press_releases/bostonx_announcement.html'}, - name="press/bostonx-announcement"), - url(r'^press/eric-lander-secret-of-life$', 'static_template_view.views.render', - {'template': 'press_releases/eric_lander_secret_of_life.html'}, - name="press/eric-lander-secret-of-life"), - url(r'^press/edx-expands-internationally$', 'static_template_view.views.render', - {'template': 'press_releases/edx_expands_internationally.html'}, - name="press/edx-expands-internationally"), - url(r'^press/xblock_announcement$', 'static_template_view.views.render', - {'template': 'press_releases/xblock_announcement.html'}, - name="press/xblock-announcement"), - url(r'^press/stanford-to-work-with-edx$', 'static_template_view.views.render', - {'template': 'press_releases/stanford_announcement.html'}, - name="press/stanford-to-work-with-edx"), - - # Should this always update to point to the latest press release? - (r'^pressrelease$', 'django.views.generic.simple.redirect_to', - {'url': '/press/xblock-announcement'}), - + url(r'^press/([^/]+)$', 'static_template_view.views.render_press_release', name='press_release'), + # Favicon (r'^favicon\.ico$', 'django.views.generic.simple.redirect_to', {'url': '/static/images/favicon.ico'}), # TODO: These urls no longer work. They need to be updated before they are re-enabled From bcdc6db4a9a1480d7ffb66d3449bbe3e129544cf Mon Sep 17 00:00:00 2001 From: Sef Kloninger Date: Wed, 10 Apr 2013 02:26:43 -0400 Subject: [PATCH 06/13] press releases: fix stanford announcement in rss feed --- lms/templates/feed.rss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lms/templates/feed.rss b/lms/templates/feed.rss index 3878f0d09f..5eaa29a574 100644 --- a/lms/templates/feed.rss +++ b/lms/templates/feed.rss @@ -11,7 +11,7 @@ tag:www.edx.org,2012:Post/17 2012-12-19T14:00:00-07:00 2012-12-19T14:00:00-07:00 - + Stanford University to Collaborate with edX on Development of Non-Profit Open Source edX Platform <img src="${static.url('images/press/releases/stanford-university_204x114.png')}" /> <p></p> From bd2330a8f0a1fb2ac06aa95c360efdc579bbac53 Mon Sep 17 00:00:00 2001 From: Sef Kloninger Date: Wed, 10 Apr 2013 08:20:30 -0400 Subject: [PATCH 07/13] press releases: more explicitly match on slug (safety) --- lms/djangoapps/static_template_view/tests.py | 8 ++++++++ lms/urls.py | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/lms/djangoapps/static_template_view/tests.py b/lms/djangoapps/static_template_view/tests.py index 806242c6d2..9cd5502d5d 100644 --- a/lms/djangoapps/static_template_view/tests.py +++ b/lms/djangoapps/static_template_view/tests.py @@ -51,3 +51,11 @@ class SimpleTest(TestCase): response = self.client.get("/press/this-shouldnt-work") self.assertEqual(response.status_code, 404) + # can someone do something fishy? no. + response = self.client.get("/press/../homework.html") + self.assertEqual(response.status_code, 404) + + # "." in is ascii 2E + response = self.client.get("/press/%2E%2E/homework.html") + self.assertEqual(response.status_code, 404) + diff --git a/lms/urls.py b/lms/urls.py index 5251330cd8..d72112593a 100644 --- a/lms/urls.py +++ b/lms/urls.py @@ -117,7 +117,7 @@ urlpatterns = ('', {'template': 'honor.html'}, name="honor"), #Press releases - url(r'^press/([^/]+)$', 'static_template_view.views.render_press_release', name='press_release'), + url(r'^press/([_a-zA-Z0-9-]+)$', 'static_template_view.views.render_press_release', name='press_release'), # Favicon (r'^favicon\.ico$', 'django.views.generic.simple.redirect_to', {'url': '/static/images/favicon.ico'}), From 03daefb9246e8aa8a5e936c7e89e9267ef2dbcc0 Mon Sep 17 00:00:00 2001 From: Diana Huang Date: Thu, 18 Apr 2013 14:31:51 -0400 Subject: [PATCH 08/13] Change the name of the plot button --- common/lib/capa/capa/templates/matlabinput.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/lib/capa/capa/templates/matlabinput.html b/common/lib/capa/capa/templates/matlabinput.html index 6c02e8e68e..04c91972d4 100644 --- a/common/lib/capa/capa/templates/matlabinput.html +++ b/common/lib/capa/capa/templates/matlabinput.html @@ -34,7 +34,7 @@
- +
- + - + @@ -97,8 +97,8 @@ from contentstore import utils
  1. - - Leeway on due dates + + Leeway on due dates (using HH:MM format)
@@ -112,13 +112,13 @@ from contentstore import utils
    - -
+ + From ba4c0b6d5318b1cd697e2a4c5b3176b4bff3eb55 Mon Sep 17 00:00:00 2001 From: Brian Talbot Date: Mon, 22 Apr 2013 09:43:57 -0400 Subject: [PATCH 11/13] studio - removing formatting suggestion from label --- cms/templates/settings_graders.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cms/templates/settings_graders.html b/cms/templates/settings_graders.html index a2f3f7022e..2e98409585 100644 --- a/cms/templates/settings_graders.html +++ b/cms/templates/settings_graders.html @@ -98,7 +98,7 @@ from contentstore import utils
  • - Leeway on due dates (using HH:MM format) + Leeway on due dates
  • From 506a9a20aaef0ce0d8d0997096e08071a4769d7d Mon Sep 17 00:00:00 2001 From: Chris Dodge Date: Mon, 22 Apr 2013 10:13:33 -0400 Subject: [PATCH 12/13] when updating the list of children of sequentials, we must use the 'direct' store otherwise we end up with draft revisions of sequentials, which is bad --- cms/djangoapps/contentstore/tests/test_contentstore.py | 9 +++++++-- common/lib/xmodule/xmodule/modulestore/xml_importer.py | 6 +++--- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/cms/djangoapps/contentstore/tests/test_contentstore.py b/cms/djangoapps/contentstore/tests/test_contentstore.py index e40d7c57b9..ed95d81d67 100644 --- a/cms/djangoapps/contentstore/tests/test_contentstore.py +++ b/cms/djangoapps/contentstore/tests/test_contentstore.py @@ -9,7 +9,6 @@ from tempdir import mkdtemp_clean from fs.osfs import OSFS import copy from json import loads -import traceback from datetime import timedelta from django.contrib.auth.models import User @@ -397,7 +396,7 @@ class ContentStoreToyCourseTest(ModuleStoreTestCase): # We had a bug where orphaned draft nodes caused export to fail. This is here to cover that case. draft_store.clone_item(vertical.location, Location(['i4x', 'edX', 'full', - 'vertical', 'no_references', 'draft'])) + 'vertical', 'no_references', 'draft'])) for child in vertical.get_children(): draft_store.clone_item(child.location, child.location) @@ -478,6 +477,12 @@ class ContentStoreToyCourseTest(ModuleStoreTestCase): for child in vertical.get_children(): self.assertTrue(getattr(child, 'is_draft', False)) + # make sure that we don't have a sequential that is in draft mode + sequential = draft_store.get_item(Location(['i4x', 'edX', 'full', + 'sequential', 'Administrivia_and_Circuit_Elements', None])) + + self.assertFalse(getattr(sequential, 'is_draft', False)) + # verify that we have the private vertical test_private_vertical = draft_store.get_item(Location(['i4x', 'edX', 'full', 'vertical', 'vertical_66', None])) diff --git a/common/lib/xmodule/xmodule/modulestore/xml_importer.py b/common/lib/xmodule/xmodule/modulestore/xml_importer.py index 6355204d07..71c6983644 100644 --- a/common/lib/xmodule/xmodule/modulestore/xml_importer.py +++ b/common/lib/xmodule/xmodule/modulestore/xml_importer.py @@ -274,7 +274,7 @@ def import_from_xml(store, data_dir, course_dirs=None, # now import any 'draft' items if draft_store is not None: - import_course_draft(xml_module_store, draft_store, course_data_path, + import_course_draft(xml_module_store, store, draft_store, course_data_path, static_content_store, target_location_namespace if target_location_namespace is not None else course_location) @@ -339,7 +339,7 @@ def import_module(module, store, course_data_path, static_content_store, allow_n store.update_metadata(module.location, dict(own_metadata(module))) -def import_course_draft(xml_module_store, store, course_data_path, static_content_store, target_location_namespace): +def import_course_draft(xml_module_store, store, draft_store, course_data_path, static_content_store, target_location_namespace): ''' This will import all the content inside of the 'drafts' folder, if it exists NOTE: This is not a full course import, basically in our current application only verticals (and downwards) @@ -396,7 +396,7 @@ def import_course_draft(xml_module_store, store, course_data_path, static_conten del module.xml_attributes['parent_sequential_url'] del module.xml_attributes['index_in_children_list'] - import_module(module, store, course_data_path, static_content_store, allow_not_found=True) + import_module(module, draft_store, course_data_path, static_content_store, allow_not_found=True) for child in module.get_children(): _import_module(child) From 32881ed265c771d04b89186f96415a220b786b65 Mon Sep 17 00:00:00 2001 From: Diana Huang Date: Mon, 22 Apr 2013 16:38:41 -0400 Subject: [PATCH 13/13] Change the name of the button so that it is clearer. --- common/lib/capa/capa/templates/matlabinput.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/lib/capa/capa/templates/matlabinput.html b/common/lib/capa/capa/templates/matlabinput.html index 7ca9a1961f..69e412f43e 100644 --- a/common/lib/capa/capa/templates/matlabinput.html +++ b/common/lib/capa/capa/templates/matlabinput.html @@ -35,7 +35,7 @@ % if button_enabled:
    - +
    %endif