[PATCH 1/2] urls: Move 'help/about' to 'about'

Daniel Axtens dja at axtens.net
Tue Nov 1 08:14:35 AEDT 2016


Stephen Finucane <stephen at that.guru> writes:

> 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.

A few questions:

 - You mentioned this is the standard URL: are you referring to a
   particular standard, or to a looser convention?

 - Is there any benefit to changing this apart from moving towards a
   more standard URL?

 - Are we stuck with the old URL 404ing, or can we put in a 301?

Regards,
Daniel

>
> Signed-off-by: Stephen Finucane <stephen at that.guru>
> ---
>  .../templates/patchwork/{help => }/about.html      |  0
>  patchwork/templates/patchwork/help/index.html      |  2 --
>  patchwork/templates/patchwork/help/pwclient.html   | 24 ----------------------
>  patchwork/templates/patchwork/project.html         | 19 ++++++++++++-----
>  patchwork/urls.py                                  |  6 +++---
>  patchwork/views/{help.py => about.py}              | 18 +++-------------
>  patchwork/views/xmlrpc.py                          |  3 +--
>  templates/base.html                                |  2 +-
>  8 files changed, 22 insertions(+), 52 deletions(-)
>  rename patchwork/templates/patchwork/{help => }/about.html (100%)
>  delete mode 100644 patchwork/templates/patchwork/help/index.html
>  delete mode 100644 patchwork/templates/patchwork/help/pwclient.html
>  rename patchwork/views/{help.py => about.py} (73%)
>
> diff --git a/patchwork/templates/patchwork/help/about.html b/patchwork/templates/patchwork/about.html
> similarity index 100%
> rename from patchwork/templates/patchwork/help/about.html
> rename to patchwork/templates/patchwork/about.html
> 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 %}
> -<h1>pwclient</h1>
> -
> -<p><code>pwclient</code> is the command-line client for Patchwork. Currently,
> -it provides access to some read-only features of Patchwork, such as downloading
> -and applying patches.</p>
> -
> -<p>To use pwclient, you will need:</p>
> -<ul>
> - <li>The <a href="{% url 'pwclient' %}">pwclient</a>
> -  program (11kB, python script)</li>
> - <li>(optional) a <code>.pwclientrc</code> file in your home directory.</li>
> -</ul>
> -
> -<p>You can create your own <code>.pwclientrc</code> file. Each
> -<a href="{% url 'project-list' %}">Patchwork project</a>
> -provides a sample linked from the 'project info' page.</p>
> -
> -{% 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 @@
>  </table>
>  
>  {% if enable_xmlrpc %}
> -<p>Sample <a href="{% url 'help' "pwclient/" %}">Patchwork
> -client</a> configuration for this project: <a
> -href="{% url 'pwclientrc' project.linkname %}"
> ->.pwclientrc</a>.</p>
> -{% endif %}
> +<h2>pwclient</h2>
> +
> +<p><code>pwclient</code> is the command-line client for Patchwork. Currently,
> +it provides access to some read-only features of Patchwork, such as downloading
> +and applying patches.</p>
>  
> +<p>To use pwclient, you will need:</p>
> +<ul>
> + <li>The <a href="{% url 'pwclient' %}">pwclient</a>
> +  program (11kB, python script)</li>
> + <li>(optional) A <code><a href="{% url 'pwclientrc' project.linkname %}"
> + >.pwclientrc</a></code> file for this project, which should be stored in your
> + home directory.</li>
> +</ul>
> +{% endif %}
>  {% endblock %}
> diff --git a/patchwork/urls.py b/patchwork/urls.py
> index 33e4781..e846c10 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,8 @@ 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<path>.*)$', help_views.detail, name='help'),
> +    # about
> +    url(r'^about/$', about_views.about, name='about'),
>  ]
>  
>  if 'debug_toolbar' in settings.INSTALLED_APPS:
> diff --git a/patchwork/views/help.py b/patchwork/views/about.py
> similarity index 73%
> rename from patchwork/views/help.py
> rename to patchwork/views/about.py
> index 7666b0a..5fd50c1 100644
> --- a/patchwork/views/help.py
> +++ b/patchwork/views/about.py
> @@ -1,5 +1,6 @@
>  # Patchwork - automated patch tracking system
>  # Copyright (C) 2008 Jeremy Kerr <jk at ozlabs.org>
> +# Copyright (C) 2016 Stephen Finucane <stephen at that.guru>
>  #
>  # This file is part of the Patchwork package.
>  #
> @@ -20,21 +21,8 @@
>  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
> +def about(request):
> +    return render(request, 'patchwork/about.html')
> diff --git a/patchwork/views/xmlrpc.py b/patchwork/views/xmlrpc.py
> index cfb80d3..0ed2568 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 @@
>    <div id="footer">
>     <a href="http://jk.ozlabs.org/projects/patchwork/">patchwork</a>
>     patch tracking system | <a
> -   href="{% url 'help' path="about/" %}">about patchwork</a>
> +   href="{% url 'about' %}">about patchwork</a>
>    </div>
>   </body>
>  </html>
> -- 
> 2.7.4
>
> _______________________________________________
> Patchwork mailing list
> Patchwork at lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/patchwork


More information about the Patchwork mailing list