Redirect in contrib.comments incorrect with default template
|Reported by:||Ryan Freckleton||Owned by:||nobody|
|Severity:||Keywords:||comments redirect bug|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
The form generated by flagging in contrib.comments includes the following:
<input type="hidden" name="next" value="None" id="next" />
As you can see, the value is the string "None". This POST is passed to the next_redirect method in django.contrib.comments.views.utils, where it is check against this code (source:django/trunk/django/contrib/comments/views/utils.py):
next = data.get("next", default) if next is None: next = urlresolvers.reverse(default_view) if get_kwargs: next += "?" + urllib.urlencode(get_kwargs) return HttpResponseRedirect(next)
Now, next is set to the string "None" when there isn't any redirect, since it exists the data.get('next', default) returns the string "None". Since there isn't any page called "None" this causes the redirect machinery to apparently go off into the weeds and not ever respond to the user with a page.
It seems like the template has to be changed to conditionally display the hidden input. I can code up a quick patch if this is the case.