From: Magnus Hagander Date: Sat, 12 Jan 2013 18:03:48 +0000 (+0100) Subject: Support redirect when we get a messageid hit in archives search X-Git-Url: http://git.postgresql.org/gitweb/?a=commitdiff_plain;h=64386af3977b472bedc9223fe024f94b5d749a21;p=pgweb.git Support redirect when we get a messageid hit in archives search --- diff --git a/pgweb/search/views.py b/pgweb/search/views.py index 49eb3159..30b9cf66 100644 --- a/pgweb/search/views.py +++ b/pgweb/search/views.py @@ -193,6 +193,13 @@ def search(request): memc.set(urlstr, hits, 60*10, 1) memc = None + if isinstance(hits, dict): + # This is not just a list of hits. + # Right now the only supported dict result is a messageid + # match, but make sure that's what it is. + if hits['messageidmatch'] == 1: + return HttpResponseRedirect("/message-id/%s" % query) + totalhits = len(hits) querystr = "?m=1&q=%s&l=%s&d=%s&s=%s" % ( urllib.quote_plus(query.encode('utf-8')),