Commit 90d53c71 authored by Jeremy Kerr's avatar Jeremy Kerr
Browse files

Make pwclient visible thorugh site, and add .pwclientrc infrastructure


Signed-off-by: default avatarJeremy Kerr <jk@ozlabs.org>
parent df3a4a38
......@@ -20,6 +20,7 @@
from django.template import RequestContext
from django.utils.html import escape
from django.contrib.sites.models import Site
from django.conf import settings
from patchwork.filters import Filters
from patchwork.models import Bundle, Project
......@@ -67,6 +68,7 @@ class PatchworkRequestContext(RequestContext):
self.update({
'project': self.project,
'site': Site.objects.get_current(),
'settings': settings,
'other_projects': len(self.projects) > 1
})
......
......@@ -58,6 +58,7 @@ urlpatterns = patterns('',
if settings.ENABLE_XMLRPC:
urlpatterns += patterns('',
(r'^pwclient.py/$', 'patchwork.views.pwclient'),
(r'^project/(?P<project_id>[^/]+)/pwclientrc/$',
'patchwork.views.pwclientrc'),
)
......@@ -30,6 +30,7 @@ import django.core.urlresolvers
from patchwork.requestcontext import PatchworkRequestContext
from django.core import serializers
from django.template.loader import render_to_string
from django.conf import settings
def projects(request):
context = PatchworkRequestContext(request)
......@@ -66,6 +67,13 @@ def pwclientrc(request, project_id):
response.write(render_to_string('patchwork/pwclientrc', context))
return response
def pwclient(request):
context = PatchworkRequestContext(request)
response = HttpResponse(mimetype = "text/x-python")
response['Content-Disposition'] = 'attachment; filename=pwclient.py'
response.write(render_to_string('patchwork/pwclient.py', context))
return response
def submitter_complete(request):
search = request.GET.get('q', '')
response = HttpResponse(mimetype = "text/plain")
......@@ -75,7 +83,12 @@ def submitter_complete(request):
json_serializer.serialize(queryset, ensure_ascii=False, stream=response)
return response
help_pages = {'': 'index.html', 'about/': 'about.html'}
help_pages = {'': 'index.html',
'about/': 'about.html',
}
if settings.ENABLE_XMLRPC:
help_pages['pwclient/'] = 'pwclient.html'
def help(request, path):
context = PatchworkRequestContext(request)
......
{% extends "base.html" %}
{% block title %}Command-line client{% endblock %}
{% block heading %} - Command-line client{% endblock %}
{% block body %}
<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 patchwork.views.pwclient %}">pwclient.py</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 patchwork.views.projects %}">patchwork project</a>
provides a sample linked from the 'project info' page.</p>
{% endblock %}
......@@ -28,5 +28,12 @@
<td>{{n_patches}} (+ {{n_archived_patches}} archived)</td>
</tr>
</table>
{% if settings.ENABLE_XMLRPC %}
<p>Sample <a href="{% url patchwork.views.help "pwclient/" %}">patchwork
client</a> configuration for this project: <a
href="{% url patchwork.views.pwclientrc project.linkname %}"
>.pwclientrc</a>.</p>
{% endif %}
{% endblock %}
../../apps/patchwork/bin/pwclient.py
\ No newline at end of file
......@@ -6,8 +6,10 @@
[base]
url: http://{{site.domain}}{% url django_xmlrpc.views.handle_xmlrpc %}
project: {{ project.linkname }}
{% comment %}
{% if user.is_authenticated %}
[auth]
user: {{ user.username }}
password: <add your patchwork password here>
{% endif %}
{% endcomment %}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment