summaryrefslogtreecommitdiff
path: root/packages
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2010-02-16 19:55:54 -0600
committerDan McGee <dan@archlinux.org>2010-02-16 19:56:40 -0600
commit95a6e6070cd036fadaafd954777c73846d6d65a3 (patch)
tree104c8d1d117c77e43efb0faac951ef4dafee5fe1 /packages
parente732861961feca370d6472b5bd64242faaa2fab6 (diff)
Use unicode-safe urlencode in package search
Django already provides an implementation of urlencode that is Unicode-safe. Use it instead of our own version. Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'packages')
-rw-r--r--packages/views.py13
1 files changed, 4 insertions, 9 deletions
diff --git a/packages/views.py b/packages/views.py
index 487f20df..58d61487 100644
--- a/packages/views.py
+++ b/packages/views.py
@@ -1,4 +1,3 @@
-import urllib
from django import forms
from django.core.mail import send_mail
from django.shortcuts import render_to_response
@@ -10,7 +9,10 @@ from django.contrib.auth.decorators import permission_required
from django.contrib.admin.widgets import AdminDateWidget
from django.views.generic import list_detail
from django.db.models import Q
+from django.utils.http import urlencode
+
import datetime
+
from main.models import Package, PackageFile
from main.models import Arch, Repo, Signoff
from main.utils import make_choice
@@ -128,14 +130,7 @@ def search(request, page=None):
packages = Package.objects.select_related('arch', 'repo', 'maintainer')
if request.GET:
- # urlencode can't handle unicode. One fix for this is to call:
- # urllib.urlencode(request.GET, doseq), which has a side effect of
- # converting unicode to ascii, and replacing unknown characters with ?.
- # Using UTF8 seems to work just as well without data loss.
- encoded = {}
- for key in request.GET:
- encoded[key] = request.GET[key].encode('UTF8')
- current_query += urllib.urlencode(encoded)
+ current_query += urlencode(request.GET)
form = PackageSearchForm(data=request.GET)
if form.is_valid():
if form.cleaned_data['repo']: