Ticket #12151: 12151-kmt.diff
File 12151-kmt.diff, 1.8 KB (added by , 15 years ago) |
---|
-
django/contrib/comments/views/utils.py
39 39 if 'c' in request.GET: 40 40 try: 41 41 comment = comments.get_model().objects.get(pk=request.GET['c']) 42 except ObjectDoesNotExist:42 except (ObjectDoesNotExist, ValueError): 43 43 pass 44 44 return render_to_response(template, 45 45 {'comment': comment}, -
tests/regressiontests/comment_tests/tests/comment_view_tests.py
219 219 location = response["Location"] 220 220 match = re.search(r"^http://testserver/somewhere/else/\?foo=bar&c=\d+$", location) 221 221 self.failUnless(match != None, "Unexpected redirect location: %s" % location) 222 223 No newline at end of file 222 223 def testCommentDoneReSubmitWithInvalidParams(self): 224 """ 225 Tests that attempting to retrieve the location specified in the 226 post redirect, after adding some invalid data to the expected 227 querystring it ends with, doesn't cause a server error. 228 """ 229 a = Article.objects.get(pk=1) 230 data = self.getValidData(a) 231 data["comment"] = "This is another comment" 232 response = self.client.post("/post/", data) 233 location = response["Location"] 234 broken_location = location + u"\ufffd" 235 response = self.client.get(broken_location) 236 self.assertEqual(response.status_code, 200)