summaryrefslogtreecommitdiff
path: root/packages/views.py
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2011-04-16 09:34:31 -0500
committerDan McGee <dan@archlinux.org>2011-04-16 09:43:45 -0500
commit9fd0995aa5567bc3b2df939cebb02cc6efeaa3b6 (patch)
tree0d0320974ae33c3d36ed21ea4c1cffee65db4bb5 /packages/views.py
parent96c59b1dc22b7318eadeaec11e7fed25829cecd5 (diff)
Only include known values in generated search query
Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'packages/views.py')
-rw-r--r--packages/views.py11
1 files changed, 9 insertions, 2 deletions
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 django.views.generic.simple import direct_to_template
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 = []