summaryrefslogtreecommitdiff
path: root/packages
diff options
context:
space:
mode:
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 24264af0..dd5b9347 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:]]