summaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2010-02-17 02:55:54 +0100
committerDan McGee <dan@archlinux.org>2010-02-17 02:56:40 +0100
commit95a6e6070cd036fadaafd954777c73846d6d65a3 (patch)
tree104c8d1d117c77e43efb0faac951ef4dafee5fe1 /packages
parente732861961feca370d6472b5bd64242faaa2fab6 (diff)
downloadarchweb-95a6e6070cd036fadaafd954777c73846d6d65a3.tar.gz
archweb-95a6e6070cd036fadaafd954777c73846d6d65a3.tar.xz
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 487f20d..58d6148 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']: