diff options
author | Luke Shumaker <lukeshu@sbcglobal.net> | 2015-04-15 21:47:49 -0400 |
---|---|---|
committer | Luke Shumaker <lukeshu@parabola.nu> | 2019-03-10 01:08:39 -0500 |
commit | 2d41298fbb89a87ce7628793c9a94665fe5e8a35 (patch) | |
tree | 08485d507a5459cf1328a474dd257e54a3109ed4 | |
parent | ff4855ac500d3c78589a12816b8fe69ed3c58281 (diff) |
Redirect several URLs at the router level.
-rw-r--r-- | public/tests.py | 8 | ||||
-rw-r--r-- | public/views.py | 13 | ||||
-rw-r--r-- | templates/public/art.html | 60 | ||||
-rw-r--r-- | templates/public/donate.html | 27 | ||||
-rw-r--r-- | urls.py | 12 |
5 files changed, 14 insertions, 106 deletions
diff --git a/public/tests.py b/public/tests.py index dd4be4f5..1e741f16 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 9702526c..1002c8c7 100644 --- a/public/views.py +++ b/public/views.py @@ -45,14 +45,6 @@ def people(request, slug): 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.''' @@ -63,11 +55,6 @@ def _mirror_urls(): return sorted(urls, key=sort_by) -@cache_control(max_age=300) -def download(request): - return HttpResponseRedirect('https://wiki.parabola.nu/get') - - @cache_control(max_age=307) def feeds(request): repos = Repo.objects.all() diff --git a/templates/public/art.html b/templates/public/art.html deleted file mode 100644 index ee2b337e..00000000 --- a/templates/public/art.html +++ /dev/null @@ -1,60 +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 Parabola GNU/Linux-libre.</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/> - -{% comment %} -<!-- 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="{{ BRANDING_DISTRONAME }} PNG logo @ 90dpi" title="{{ BRANDING_DISTRONAME }} 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 e171b40e..00000000 --- a/templates/public/donate.html +++ /dev/null @@ -1,27 +0,0 @@ -{% extends "base.html" %} -{% load cache %} -{% load static from staticfiles %} - -{% block title %}{{ BRANDING_DISTRONAME }} - Donate{% endblock %} - -{% block content %} -{% cache 600 donations secure %} -<div id="donations" class="box"> - - <h2>Donate to {{ BRANDING_DISTRONAME }}</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='http://wiki.parabolagnulinux.org/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 %} @@ -28,12 +28,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'^donate/$', 'donate', {}, 'page-donate'), - (r'^download/$', 'download', {}, 'page-download'), + (r'^hackers/$', 'userlist', { 'user_type':'hackers' }, 'page-devs'), + (r'^fellows/$', 'userlist', { 'user_type':'fellows' }, 'page-fellows'), + (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'), (r'^people/(?P<slug>[-\w]+)/$', 'people', {}, 'people'), |