diff options
author | Luke Shumaker <lukeshu@sbcglobal.net> | 2015-04-15 21:47:49 -0400 |
---|---|---|
committer | Luke Shumaker <lukeshu@sbcglobal.net> | 2015-04-15 21:47:49 -0400 |
commit | ce1f17e5104d44fa833090c47dd76466a2d7f743 (patch) | |
tree | b304b5bacde314f817aa11b1fa9358296fec6530 /public | |
parent | 993d1a584f7aff8d0975495bef81850c756eec10 (diff) |
Redirect several URLs at the router level.
Diffstat (limited to 'public')
-rw-r--r-- | public/tests.py | 8 | ||||
-rw-r--r-- | public/views.py | 14 |
2 files changed, 7 insertions, 15 deletions
diff --git a/public/tests.py b/public/tests.py index 49bbd2bb..d0140e98 100644 --- a/public/tests.py +++ b/public/tests.py @@ -13,7 +13,9 @@ class PublicTest(TestCase): def test_art(self): response = self.client.get('/art/') - self.assertEqual(response.status_code, 200) + self.assertEqual(response.status_code, 302) + self.assertTrue(response['Location'].startswith( + 'https://projects.parabola.nu/artwork.git/') def test_svn(self): response = self.client.get('/svn/') @@ -35,7 +37,9 @@ class PublicTest(TestCase): def test_donate(self): response = self.client.get('/donate/') - self.assertEqual(response.status_code, 200) + self.assertEqual(response.status_code, 302) + self.assertEqual(response['Location'], + 'https://wiki.parabola.nu/Donations') def test_download(self): response = self.client.get('/download/') diff --git a/public/views.py b/public/views.py index 0b245071..57634983 100644 --- a/public/views.py +++ b/public/views.py @@ -5,7 +5,7 @@ from operator import attrgetter from django.conf import settings from django.contrib.auth.models import User from django.db.models import Count, Q -from django.http import Http404, HttpResponse, HttpResponseRedirect +from django.http import Http404, HttpResponse from django.shortcuts import render from django.views.decorators.cache import cache_control, cache_page @@ -63,14 +63,6 @@ def userlist(request, user_type='hackers'): return render(request, 'public/userlist.html', context) -@cache_control(max_age=307) -def donate(request): - context = { - 'donors': Donor.objects.filter(visible=True).order_by('name'), - } - return render(request, 'public/donate.html', context) - - def _mirror_urls(): '''In order to ensure this is lazily evaluated since we can't do sorting at the database level, make it a callable.''' @@ -82,10 +74,6 @@ def _mirror_urls(): @cache_control(max_age=307) -def download(request): - return HttpResponseRedirect('https://wiki.parabola.nu/Get_Parabola') - -@cache_control(max_age=307) def feeds(request): repos = Repo.objects.all() if not request.user.is_authenticated(): |