Ticket #5236: my-twisted-patch.patch
| File my-twisted-patch.patch, 1.2 KB (added by moijes12, 17 months ago) |
|---|
-
twisted/web/util.py
14 14 15 15 16 16 def redirectTo(URL, request): 17 # Patch for #5236 18 # If Unicode object is passed in URL, redirectTo raises TypeError 19 if isinstance(URL, unicode) : 20 raise TypeError("Unicode object not allowed as URL") 17 21 request.setHeader("content-type", "text/html; charset=utf-8") 18 22 request.redirect(URL) 19 23 return """ -
twisted/web/test/test_util.py
73 73 request.responseHeaders.getRawHeaders('content-type'), 74 74 ['text/html; charset=utf-8']) 75 75 76 76 def test_redirectToUnicodeURL(self) : 77 """ 78 L{redirectTo} will raise TypeError if unicode object is passed in URL 79 """ 80 request = Request(DummyChannel(), True) 81 request.method = 'GET' 82 targetURL = u'http://target.example.com/4321' 83 self.assertRaises(TypeError, redirectTo, targetURL, request)
