From 6fa81606a78f3dcc3160c0117be378bb861b1ded Mon Sep 17 00:00:00 2001 From: Jeremy Kerr Date: Fri, 19 Mar 2010 15:56:04 +0800 Subject: [PATCH] views: Use request scheme in sample pwclientrc file. Adapt the pwclientrc file to suit the current scheme in use. Signed-off-by: Jeremy Kerr --- apps/patchwork/views/base.py | 4 ++++ templates/patchwork/pwclientrc | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/apps/patchwork/views/base.py b/apps/patchwork/views/base.py index 338c673..bb78fa4 100644 --- a/apps/patchwork/views/base.py +++ b/apps/patchwork/views/base.py @@ -47,6 +47,10 @@ def pwclientrc(request, project_id): project = get_object_or_404(Project, linkname = project_id) context = PatchworkRequestContext(request) context.project = project + if request.is_secure(): + context['scheme'] = 'https' + else: + context['scheme'] = 'http' response = HttpResponse(mimetype = "text/plain") response['Content-Disposition'] = 'attachment; filename=.pwclientrc' response.write(render_to_string('patchwork/pwclientrc', context)) diff --git a/templates/patchwork/pwclientrc b/templates/patchwork/pwclientrc index 5fb1f47..c932b11 100644 --- a/templates/patchwork/pwclientrc +++ b/templates/patchwork/pwclientrc @@ -4,7 +4,7 @@ # Save this file to ~/.pwclientrc # [base] -url: http://{{site.domain}}{% url patchwork.views.xmlrpc.xmlrpc %} +url: {{scheme}}://{{site.domain}}{% url patchwork.views.xmlrpc.xmlrpc %} project: {{ project.linkname }} {% if user.is_authenticated %} # Adding authentication parameters will allow you to use the 'update' -- 2.39.2