summaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2011-03-13 18:02:59 +0100
committerDan McGee <dan@archlinux.org>2011-03-13 18:03:01 +0100
commitba1ca7db1e16400651bb746b8b80f2b30cf88a2f (patch)
treef9ac40c6a2f1a2c72d9b3801fc592a18a3d895fe /packages
parent5abe0727bfa9a4fab24afcccb66da7d8832bf6b9 (diff)
downloadarchweb-ba1ca7db1e16400651bb746b8b80f2b30cf88a2f.tar.gz
archweb-ba1ca7db1e16400651bb746b8b80f2b30cf88a2f.tar.xz
Ensure PyPy compatibility
Unfortunately I was relying on all python environments having this method defined, which is not true yet. Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'packages')
-rw-r--r--packages/templatetags/package_extras.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/packages/templatetags/package_extras.py b/packages/templatetags/package_extras.py
index 24264af..dd5b934 100644
--- a/packages/templatetags/package_extras.py
+++ b/packages/templatetags/package_extras.py
@@ -1,5 +1,8 @@
import urllib
-import urlparse
+try:
+ from urlparse import parse_qs
+except ImportError:
+ from cgi import parse_qs
from django import template
from django.utils.html import escape
@@ -11,7 +14,7 @@ class BuildQueryStringNode(template.Node):
self.sortfield = sortfield
def render(self, context):
- qs = urlparse.parse_qs(context['current_query'])
+ qs = parse_qs(context['current_query'])
if qs.has_key('sort') and self.sortfield in qs['sort']:
if self.sortfield.startswith('-'):
qs['sort'] = [self.sortfield[1:]]