Commit 1e4c83dc authored by Damien Lespiau's avatar Damien Lespiau
Browse files

patch: Add a way to access a patch by its Message-ID

Similar to:

It's really handy to be able to find a patchwork patch from the original
mail. For instance, a key stroke in mutt will open the patch page in the
Suggested-by: Jani Nikula's avatarJani Nikula <>
Signed-off-by: default avatarDamien Lespiau <>
parent 98d247ca
......@@ -35,6 +35,7 @@ urlpatterns = patterns('',
(r'^patch/(?P<patch_id>\d+)/$', 'patchwork.views.patch.patch'),
(r'^patch/(?P<patch_id>\d+)/raw/$', 'patchwork.views.patch.content'),
(r'^patch/(?P<patch_id>\d+)/mbox/$', 'patchwork.views.patch.mbox'),
(r'^patch/msgid/(?P<msgid>[^/]+)/$', 'patchwork.views.patch.msgid'),
# logged-in user stuff
(r'^user/$', 'patchwork.views.user.profile'),
......@@ -21,7 +21,7 @@
from patchwork.models import Patch, Project, Bundle
from patchwork.forms import PatchForm, CreateBundleForm
from patchwork.requestcontext import PatchworkRequestContext
from django.shortcuts import render_to_response, get_object_or_404
from django.shortcuts import render_to_response, get_object_or_404, redirect
from django.http import HttpResponse, HttpResponseForbidden
from patchwork.views import generic_list, patch_to_mbox
......@@ -105,3 +105,7 @@ def list(request, project_id):
context = generic_list(request, project, 'patchwork.views.patch.list',
view_args = {'project_id': project.linkname})
return render_to_response('patchwork/list.html', context)
def msgid(request, msgid):
patch = get_object_or_404(Patch, msgid='<' + msgid + '>')
return redirect(patch)
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