summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
authorJannis Leidel <jannis@leidel.info>2011-03-03 13:03:53 +0000
committerJannis Leidel <jannis@leidel.info>2011-03-03 13:03:53 +0000
commitc0fb9bd00b16bf384b726adb3c0dec34fc90e615 (patch)
tree74ecdc5dad4caa549a61574699deddd840cde752 /django
parent49cfe253991bd255e3293da545ba9af00ab6e18f (diff)
Fixed #13411 -- Made sure URL fragments are correctly handled by the next_redirect utility of the comments apps. Thanks, timesong, dpn and Julien Phalip.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15720 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django')
-rw-r--r--django/contrib/comments/views/utils.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/django/contrib/comments/views/utils.py b/django/contrib/comments/views/utils.py
index 8b729d2d95..cc985e52d2 100644
--- a/django/contrib/comments/views/utils.py
+++ b/django/contrib/comments/views/utils.py
@@ -25,8 +25,15 @@ def next_redirect(data, default, default_view, **get_kwargs):
if next is None:
next = urlresolvers.reverse(default_view)
if get_kwargs:
+ if '#' in next:
+ tmp = next.rsplit('#', 1)
+ next = tmp[0]
+ anchor = '#' + tmp[1]
+ else:
+ anchor = ''
+
joiner = ('?' in next) and '&' or '?'
- next += joiner + urllib.urlencode(get_kwargs)
+ next += joiner + urllib.urlencode(get_kwargs) + anchor
return HttpResponseRedirect(next)
def confirmation_view(template, doc="Display a confirmation view."):