summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--apps/patchwork/requestcontext.py2
-rw-r--r--apps/patchwork/urls.py1
-rw-r--r--apps/patchwork/views/base.py15
-rw-r--r--templates/patchwork/help/pwclient.html23
-rw-r--r--templates/patchwork/project.html7
l---------templates/patchwork/pwclient.py1
-rw-r--r--templates/patchwork/pwclientrc2
7 files changed, 50 insertions, 1 deletions
diff --git a/apps/patchwork/requestcontext.py b/apps/patchwork/requestcontext.py
index e9a2675..c1440dd 100644
--- a/apps/patchwork/requestcontext.py
+++ b/apps/patchwork/requestcontext.py
@@ -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
})
diff --git a/apps/patchwork/urls.py b/apps/patchwork/urls.py
index 20de7b8..f7c942a 100644
--- a/apps/patchwork/urls.py
+++ b/apps/patchwork/urls.py
@@ -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'),
)
diff --git a/apps/patchwork/views/base.py b/apps/patchwork/views/base.py
index 8697ab4..b49b221 100644
--- a/apps/patchwork/views/base.py
+++ b/apps/patchwork/views/base.py
@@ -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)
diff --git a/templates/patchwork/help/pwclient.html b/templates/patchwork/help/pwclient.html
new file mode 100644
index 0000000..efce79c
--- /dev/null
+++ b/templates/patchwork/help/pwclient.html
@@ -0,0 +1,23 @@
+{% 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 %}
diff --git a/templates/patchwork/project.html b/templates/patchwork/project.html
index f29540c..49ceb57 100644
--- a/templates/patchwork/project.html
+++ b/templates/patchwork/project.html
@@ -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 %}
diff --git a/templates/patchwork/pwclient.py b/templates/patchwork/pwclient.py
new file mode 120000
index 0000000..c196eb3
--- /dev/null
+++ b/templates/patchwork/pwclient.py
@@ -0,0 +1 @@
+../../apps/patchwork/bin/pwclient.py \ No newline at end of file
diff --git a/templates/patchwork/pwclientrc b/templates/patchwork/pwclientrc
index d7c1c32..7aaf346 100644
--- a/templates/patchwork/pwclientrc
+++ b/templates/patchwork/pwclientrc
@@ -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 %}