From 9fd0995aa5567bc3b2df939cebb02cc6efeaa3b6 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Sat, 16 Apr 2011 09:34:31 -0500 Subject: Only include known values in generated search query Signed-off-by: Dan McGee --- packages/views.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'packages') diff --git a/packages/views.py b/packages/views.py index 1587563b..73692d37 100644 --- a/packages/views.py +++ b/packages/views.py @@ -18,6 +18,7 @@ from datetime import datetime import string +from urllib import urlencode from main.models import Package, PackageFile from main.models import Arch, Repo, Signoff @@ -108,8 +109,14 @@ def details(request, name='', repo='', arch=''): return direct_to_template(request, 'packages/packages_list.html', context) else: - return redirect("/packages/?arch=%s&repo=%s&q=%s" % ( - arch.lower(), repo.title(), name)) + pkg_data = [ + ('arch', arch.lower()), + ('repo', repo.lower()), + ('q', name), + ] + # only include non-blank values in the query we generate + pkg_data = [(x, y) for x, y in pkg_data if y] + return redirect("/packages/?%s" % urlencode(pkg_data)) def groups(request, arch=None): arches = [] -- cgit v1.2.3-54-g00ecf