summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@sbcglobal.net>2015-04-15 21:47:49 -0400
committerLuke Shumaker <lukeshu@sbcglobal.net>2015-04-15 21:47:49 -0400
commitce1f17e5104d44fa833090c47dd76466a2d7f743 (patch)
treeb304b5bacde314f817aa11b1fa9358296fec6530
parent993d1a584f7aff8d0975495bef81850c756eec10 (diff)
Redirect several URLs at the router level.
-rw-r--r--public/tests.py8
-rw-r--r--public/views.py14
-rw-r--r--templates/public/art.html57
-rw-r--r--templates/public/donate.html28
-rw-r--r--urls.py14
5 files changed, 15 insertions, 106 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():
diff --git a/templates/public/art.html b/templates/public/art.html
deleted file mode 100644
index 32acc172..00000000
--- a/templates/public/art.html
+++ /dev/null
@@ -1,57 +0,0 @@
-{% extends "base.html" %}
-{% load static from staticfiles %}
-
-{% block title %}{{ BRANDING_DISTRONAME }} - Artwork{% endblock %}
-
-{% block content %}
-<div id="artwork" class="box">
-
- <h2>{{ BRANDING_DISTRONAME }} Logos and Artwork</h2>
-
- <p>You can help by creating artwork for {{ BRANDING_DISTRONAME }}.</p>
-
- <p>Send your designs to dev@lists.parabola.nu and state they are CC-by-sa
- or another free culture friendly license.</p>
-
-{% comment %}
- <h3>Logos for Press Usage</h3>
-
- <p>The following {{BRANDING_DISTRONAME}} logos are available for press and other use.</p>
-
- <p><strong>Two-color standard version</strong><br />
-
-<!-- This is an example of how images should be added here -->
- <em>Also available in print-quality
- <a href="{% static "logos/parabola-logo-dark-1200dpi.png" %}"
- title="Download 1200dpi PNG format">PNG</a> and scalable
- <a href="{% static "logos/parabola-logo-dark-scalable.svg" %}"
- title="Download scalable SVG format">SVG</a> formats.</em></p>
-
- <img src="{% static "logos/parabola-logo-dark-90dpi.png" %}"
- alt="Parabola PNG logo @ 90dpi" title="Parabola PNG logo @ 90dpi" />
-
- <p><strong>Two-color inverted version</strong> (for dark backgrounds)<br />
-
-
- <p><strong>One-color standard version</strong><br />
-
-
- <p><strong>One-colour inverted version</strong> (for dark backgrounds)<br />
-
- <h3>Logos and Artwork for the Community</h3>
-
- <p>Official logos and artwork are also available directly from the
- repositories. These packages would be:</p>
-
- <ul>
- <li><strong>parabola-artwork</strong> - official logos, icons and CD labels</li>
- <li><strong>parabola-wallpaper</strong> - a variety of desktop wallpapers
- for standard and widescreen resolutions</li>
- <li><strong>parabola-themes-kde</strong> - KDE themes and icons</li>
- <li><strong>parabola-themes-kdm</strong> - KDM login themes</li>
- <li><strong>parabola-themes-slim</strong> - SLiM login themes</li>
- </ul>
-{% endcomment %}
-
-</div><!-- #artwork -->
-{% endblock %}
diff --git a/templates/public/donate.html b/templates/public/donate.html
deleted file mode 100644
index f7087dc9..00000000
--- a/templates/public/donate.html
+++ /dev/null
@@ -1,28 +0,0 @@
-{% extends "base.html" %}
-{% load cache %}
-{% load static from staticfiles %}
-{% load wiki %}
-
-{% block title %}{{ BRANDING_DISTRONAME }} - Donate{% endblock %}
-
-{% block content %}
-{% cache 600 donations secure %}
-<div id="donations" class="box">
-
- <h2>Donate to {{ BRANDING_SHORTNAME }}</h2>
-
- <h3>We don't accept any money donations</h3>
-
- <p>That's right. At the moment, Parabola isn't accepting any money
- donations. And that's because we have nothing to do with them. We really
- don't, at the moment. So, some voluntary work is much preferred than
- anything, because we are a really small community of hackers.</p>
-
- <p>If you want, we have a pretty nice <a
- href="{% wiki_url 'TODO' %}" title="The TODO
- list!">TODO list</a> you can check to help us by donating some of your
- time. That will be very much appreciated by us :)</p>
-
-</div>
-{% endcache %}
-{% endblock %}
diff --git a/urls.py b/urls.py
index 506b83ef..e7a2cbc3 100644
--- a/urls.py
+++ b/urls.py
@@ -25,14 +25,16 @@ urlpatterns += patterns('public.views',
(r'^$', 'index', {}, 'index'),
(r'^about/$', TemplateView.as_view(template_name='public/about.html'),
{}, 'page-about'),
+ ('^art/$', RedirectView.as_view('https://projects.parabola.nu/artwork.git/'),
+ {}, 'page-art'),
(r'^https/$', TemplateView.as_view(template_name='public/https.html'),
{}, 'page-https'),
- (r'^art/$', TemplateView.as_view(template_name='public/art.html'),
- {}, 'page-art'),
(r'^hackers/$', 'userlist', { 'user_type':'hackers' }, 'page-devs'),
(r'^fellows/$', 'userlist', { 'user_type':'fellows' }, 'page-fellows'),
- (r'^donate/$', 'donate', {}, 'page-donate'),
- (r'^download/$', 'download', {}, 'page-download'),
+ (r'^donate/$', RedirectView.as_view('https://wiki.parabola.nu/Donations'),
+ {}, 'page-donate'),
+ (r'^download/$', RedirectView.as_view('https://wiki.parabola.nu/Get_Parabola'),
+ {}, 'page-download'),
(r'^master-keys/$', 'keys', {}, 'page-keys'),
(r'^master-keys/json/$', 'keys_json', {}, 'pgp-keys-json'),
)
@@ -109,8 +111,8 @@ legacy_urls = (
('^docs/',
'https://wiki.parabola.nu/'),
- ('^developers/$', '/hackers/'),
- ('^trustedusers/$', '/hackers/'),
+ ('^developers/$', '/hackers/'),
+ ('^trustedusers/$', '/hackers/'),
)
urlpatterns += [url(old_url, RedirectView.as_view(url=new_url))