diff options
Diffstat (limited to 'django/contrib/comments/views/utils.py')
| -rw-r--r-- | django/contrib/comments/views/utils.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/django/contrib/comments/views/utils.py b/django/contrib/comments/views/utils.py index 8879e9fb8f..abaed68560 100644 --- a/django/contrib/comments/views/utils.py +++ b/django/contrib/comments/views/utils.py @@ -2,8 +2,12 @@ A few bits of helper functions for comment views. """ -import urllib import textwrap +try: + from urllib.parse import urlencode +except ImportError: # Python 2 + from urllib import urlencode + from django.http import HttpResponseRedirect from django.core import urlresolvers from django.shortcuts import render_to_response @@ -33,7 +37,7 @@ def next_redirect(data, default, default_view, **get_kwargs): anchor = '' joiner = ('?' in next) and '&' or '?' - next += joiner + urllib.urlencode(get_kwargs) + anchor + next += joiner + urlencode(get_kwargs) + anchor return HttpResponseRedirect(next) def confirmation_view(template, doc="Display a confirmation view."): |
