From patchwork Sat Nov 19 18:31:32 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Finucane X-Patchwork-Id: 696876 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3tLk3p6pNKz9syB for ; Sun, 20 Nov 2016 05:32:06 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="key not found in DNS" (0-bit key; unprotected) header.d=that.guru header.i=@that.guru header.b="uP/oGPWw"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3tLk3p5lHzzDvw7 for ; Sun, 20 Nov 2016 05:32:06 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=fail reason="key not found in DNS" (0-bit key; unprotected) header.d=that.guru header.i=@that.guru header.b="uP/oGPWw"; dkim-atps=neutral X-Original-To: patchwork@lists.ozlabs.org Delivered-To: patchwork@lists.ozlabs.org Received: from burlywood.elm.relay.mailchannels.net (burlywood.elm.relay.mailchannels.net [23.83.212.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3tLk3k29bYzDvnj for ; Sun, 20 Nov 2016 05:32:01 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=fail reason="key not found in DNS" (0-bit key; unprotected) header.d=that.guru header.i=@that.guru header.b="uP/oGPWw"; dkim-atps=neutral X-Sender-Id: mxroute|x-authuser|stephen@that.guru Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id 3FEF0A0962 for ; Sat, 19 Nov 2016 18:31:58 +0000 (UTC) Received: from one.mxroute.com (ip-10-107-69-155.us-west-2.compute.internal [10.107.69.155]) by relay.mailchannels.net (Postfix) with ESMTPA id 24346A0ACE for ; Sat, 19 Nov 2016 18:31:57 +0000 (UTC) X-Sender-Id: mxroute|x-authuser|stephen@that.guru Received: from one.mxroute.com ([UNAVAILABLE]. [10.107.128.240]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384) by 0.0.0.0:2500 (trex/5.7.8); Sat, 19 Nov 2016 18:31:57 +0000 X-MC-Relay: Good X-MailChannels-SenderId: mxroute|x-authuser|stephen@that.guru X-MailChannels-Auth-Id: mxroute X-MC-Loop-Signature: 1479580317585:2155651071 X-MC-Ingress-Time: 1479580317584 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=that.guru; s=default; h=Message-Id:Date:Subject:To:From:Sender:Reply-To:Cc:MIME-Version :Content-Type:Content-Transfer-Encoding:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=Jfkm0OPBx3lEMU151UVzpKZFB4Ev8aezt5gjqzApwBU=; b=uP/oGPWwKN/xbmoXBFX6KGBC/S eDdw/z+nPqyaadABpYcR/+76+hB+PMNdtJZQVGvjxbd2NzWUvc7dKU4PHMuaNpEVBGJsbTcw94SfS 0BoaYSP7VLhA4vIhEOHjz24cSzT+Me6fSaTptOZG/3s9/thBCvN6otRAhKz+Ouef3GB3lyeJFan15 IlS3AUwbYaYqGVM2wsihYCzp0yvyPQYY5JyEgKqz4VPyXkHyYuvRD+8J4R3W/hmkbDnMLQiuE+OWu bPlVdWu8jGuDI4CJFoSaqaaqfqmXqlqCTwx1UaEcwObW0BkfeMUL2CrRDLi1txPvcEa+hU8zEXxgt Tc/yDaFQ==; From: Stephen Finucane To: patchwork@lists.ozlabs.org Subject: [PATCH v2 1/3] urls: Move 'help/about' to 'about' Date: Sat, 19 Nov 2016 18:31:32 +0000 Message-Id: <1479580294-11789-1-git-send-email-stephen@that.guru> X-Mailer: git-send-email 2.7.4 X-OutGoing-Spam-Status: No, score=-10.0 X-AuthUser: stephen@that.guru X-BeenThere: patchwork@lists.ozlabs.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Patchwork development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: patchwork-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Patchwork" This is the standard URL for such pages. This involves removing the pwclient help page, but this is migrated to the project summary page and detailed in the documentation. Permanent redirects are included to prevent dead links. Signed-off-by: Stephen Finucane Reviewed-by: Daniel Axtens --- patchwork/templates/patchwork/about.html | 14 +++++++++ patchwork/templates/patchwork/help/about.html | 14 --------- patchwork/templates/patchwork/help/index.html | 2 -- patchwork/templates/patchwork/help/pwclient.html | 24 -------------- patchwork/templates/patchwork/project.html | 19 ++++++++--- patchwork/tests/test_about.py | 32 +++++++++++++++++++ patchwork/tests/test_xmlrpc.py | 3 +- patchwork/urls.py | 12 +++++-- patchwork/views/about.py | 36 +++++++++++++++++++++ patchwork/views/help.py | 40 ------------------------ patchwork/views/xmlrpc.py | 3 +- templates/base.html | 2 +- 12 files changed, 108 insertions(+), 93 deletions(-) create mode 100644 patchwork/templates/patchwork/about.html delete mode 100644 patchwork/templates/patchwork/help/about.html delete mode 100644 patchwork/templates/patchwork/help/index.html delete mode 100644 patchwork/templates/patchwork/help/pwclient.html create mode 100644 patchwork/tests/test_about.py create mode 100644 patchwork/views/about.py delete mode 100644 patchwork/views/help.py diff --git a/patchwork/templates/patchwork/about.html b/patchwork/templates/patchwork/about.html new file mode 100644 index 0000000..ed0c421 --- /dev/null +++ b/patchwork/templates/patchwork/about.html @@ -0,0 +1,14 @@ +{% extends "base.html" %} + +{% block title %}About{% endblock %} +{% block heading %}About Patchwork{% endblock %} + +{% block body %} +

About Patchwork

+ +

Patchwork is free software, and is available from the +Patchwork website.

+ +

Patchwork is built on the Django +web framework.

+{% endblock %} diff --git a/patchwork/templates/patchwork/help/about.html b/patchwork/templates/patchwork/help/about.html deleted file mode 100644 index ed0c421..0000000 --- a/patchwork/templates/patchwork/help/about.html +++ /dev/null @@ -1,14 +0,0 @@ -{% extends "base.html" %} - -{% block title %}About{% endblock %} -{% block heading %}About Patchwork{% endblock %} - -{% block body %} -

About Patchwork

- -

Patchwork is free software, and is available from the -Patchwork website.

- -

Patchwork is built on the Django -web framework.

-{% endblock %} diff --git a/patchwork/templates/patchwork/help/index.html b/patchwork/templates/patchwork/help/index.html deleted file mode 100644 index 5cb6467..0000000 --- a/patchwork/templates/patchwork/help/index.html +++ /dev/null @@ -1,2 +0,0 @@ -{% extends "base.html" %} - diff --git a/patchwork/templates/patchwork/help/pwclient.html b/patchwork/templates/patchwork/help/pwclient.html deleted file mode 100644 index b419b42..0000000 --- a/patchwork/templates/patchwork/help/pwclient.html +++ /dev/null @@ -1,24 +0,0 @@ -{% extends "base.html" %} - -{% block title %}pwclient: The Patchwork command-line client{% endblock %} -{% block heading %}pwclient{% endblock %} - -{% block body %} -

pwclient

- -

pwclient is the command-line client for Patchwork. Currently, -it provides access to some read-only features of Patchwork, such as downloading -and applying patches.

- -

To use pwclient, you will need:

-
    -
  • The pwclient - program (11kB, python script)
  • -
  • (optional) a .pwclientrc file in your home directory.
  • -
- -

You can create your own .pwclientrc file. Each -Patchwork project -provides a sample linked from the 'project info' page.

- -{% endblock %} diff --git a/patchwork/templates/patchwork/project.html b/patchwork/templates/patchwork/project.html index 6f7e37d..74b6f0f 100644 --- a/patchwork/templates/patchwork/project.html +++ b/patchwork/templates/patchwork/project.html @@ -50,10 +50,19 @@ {% if enable_xmlrpc %} -

Sample Patchwork -client configuration for this project: .pwclientrc.

-{% endif %} +

pwclient

+ +

pwclient is the command-line client for Patchwork. Currently, +it provides access to some read-only features of Patchwork, such as downloading +and applying patches.

+

To use pwclient, you will need:

+
    +
  • The pwclient + program (11kB, python script)
  • +
  • (optional) A .pwclientrc file for this project, which should be stored in your + home directory.
  • +
+{% endif %} {% endblock %} diff --git a/patchwork/tests/test_about.py b/patchwork/tests/test_about.py new file mode 100644 index 0000000..2175641 --- /dev/null +++ b/patchwork/tests/test_about.py @@ -0,0 +1,32 @@ +# Patchwork - automated patch tracking system +# Copyright (C) 2016 Stephen Finucane +# +# This file is part of the Patchwork package. +# +# Patchwork is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# Patchwork is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Patchwork; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +from django.core.urlresolvers import reverse +from django.test import TestCase + + +class AboutViewTest(TestCase): + + def test_redirects(self): + for view in ['help', 'help-about', 'help-pwclient']: + requested_url = reverse(view) + redirect_url = reverse('about') + + response = self.client.get(requested_url) + self.assertRedirects(response, redirect_url, 301) diff --git a/patchwork/tests/test_xmlrpc.py b/patchwork/tests/test_xmlrpc.py index 3b97fb1..ddaded8 100644 --- a/patchwork/tests/test_xmlrpc.py +++ b/patchwork/tests/test_xmlrpc.py @@ -45,8 +45,7 @@ class XMLRPCGenericTest(XMLRPCTest): def test_get_redirect(self): response = self.client.patch(self.url) - self.assertRedirects( - response, reverse('help', kwargs={'path': 'pwclient/'})) + self.assertRedirects(response, reverse('project-list')) def test_invalid_method(self): with self.assertRaises(xmlrpc_client.Fault): diff --git a/patchwork/urls.py b/patchwork/urls.py index 33e4781..ec1fd7f 100644 --- a/patchwork/urls.py +++ b/patchwork/urls.py @@ -22,10 +22,10 @@ from django.conf.urls import url, include from django.contrib import admin from django.contrib.auth import views as auth_views +from patchwork.views import about as about_views from patchwork.views import api as api_views from patchwork.views import bundle as bundle_views from patchwork.views import cover as cover_views -from patchwork.views import help as help_views from patchwork.views import mail as mail_views from patchwork.views import notification as notification_views from patchwork.views import patch as patch_views @@ -122,8 +122,12 @@ urlpatterns = [ url(r'^mail/optout/$', mail_views.optout, name='mail-optout'), url(r'^mail/optin/$', mail_views.optin, name='mail-optin'), - # help! - url(r'^help/(?P.*)$', help_views.detail, name='help'), + # about + url(r'^about/$', about_views.about, name='about'), + + # legacy redirects + url(r'^help/$', about_views.redirect, name='help'), + url(r'^help/about/$', about_views.redirect, name='help-about'), ] if 'debug_toolbar' in settings.INSTALLED_APPS: @@ -140,6 +144,8 @@ if settings.ENABLE_XMLRPC: url(r'^project/(?P[^/]+)/pwclientrc/$', pwclient_views.pwclientrc, name='pwclientrc'), + # legacy redirect + url(r'^help/pwclient/$', about_views.redirect, name='help-pwclient'), ] if settings.ENABLE_REST_API: diff --git a/patchwork/views/about.py b/patchwork/views/about.py new file mode 100644 index 0000000..86ef952 --- /dev/null +++ b/patchwork/views/about.py @@ -0,0 +1,36 @@ +# Patchwork - automated patch tracking system +# Copyright (C) 2008 Jeremy Kerr +# Copyright (C) 2016 Stephen Finucane +# +# This file is part of the Patchwork package. +# +# Patchwork is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# Patchwork is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Patchwork; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +from django.conf import settings +from django.core.urlresolvers import reverse +from django.http import HttpResponsePermanentRedirect +from django.shortcuts import render + + +def about(request): + return render(request, 'patchwork/about.html') + + +def redirect(request): + """Redirect for legacy URLs. + + Remove this when Patchwork 3.0 is released. + """ + return HttpResponsePermanentRedirect(reverse('about')) diff --git a/patchwork/views/help.py b/patchwork/views/help.py deleted file mode 100644 index 7666b0a..0000000 --- a/patchwork/views/help.py +++ /dev/null @@ -1,40 +0,0 @@ -# Patchwork - automated patch tracking system -# Copyright (C) 2008 Jeremy Kerr -# -# This file is part of the Patchwork package. -# -# Patchwork is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# Patchwork is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Patchwork; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -from __future__ import absolute_import - -from django.conf import settings -from django.http import Http404 -from django.shortcuts import render - - -help_pages = { - '': 'index.html', - 'about/': 'about.html', -} - -if settings.ENABLE_XMLRPC: - help_pages['pwclient/'] = 'pwclient.html' - - -def detail(request, path): - if path in help_pages: - return render(request, - 'patchwork/help/' + help_pages[path]) - raise Http404 diff --git a/patchwork/views/xmlrpc.py b/patchwork/views/xmlrpc.py index 0c3f581..1c7f0e9 100644 --- a/patchwork/views/xmlrpc.py +++ b/patchwork/views/xmlrpc.py @@ -141,8 +141,7 @@ dispatcher = PatchworkXMLRPCDispatcher() @csrf_exempt def xmlrpc(request): if request.method not in ['POST', 'GET']: - return HttpResponseRedirect(reverse('help', - kwargs={'path': 'pwclient/'})) + return HttpResponseRedirect(reverse('project-list')) response = HttpResponse() diff --git a/templates/base.html b/templates/base.html index 3c9fc7d..8045b51 100644 --- a/templates/base.html +++ b/templates/base.html @@ -114,7 +114,7 @@