mirror of
https://github.com/django/django.git
synced 2025-11-01 20:31:40 +00:00
Fixed #17111 -- Made the redirect_to generic view properly handle query strings with percent symbols. Thanks, Chris Adams.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17034 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
2e2689c7c0
commit
4d79083453
3 changed files with 17 additions and 4 deletions
|
|
@ -115,4 +115,5 @@ urlpatterns += patterns('django.views.generic.simple',
|
|||
(r'^simple/redirect_to_none/$', 'redirect_to', dict(url=None)),
|
||||
(r'^simple/redirect_to_arg/(?P<id>\d+)/$', 'redirect_to', dict(url='/simple/target_arg/%(id)s/')),
|
||||
(r'^simple/redirect_to_query/$', 'redirect_to', dict(url='/simple/target/', query_string=True)),
|
||||
(r'^simple/redirect_to_arg_and_query/(?P<id>\d+)/$', 'redirect_to', dict(url='/simple/target_arg/%(id)s/', query_string=True)),
|
||||
)
|
||||
|
|
|
|||
|
|
@ -48,9 +48,17 @@ class RedirectToTest(TestCase):
|
|||
self.assertEqual(response.status_code, 301)
|
||||
self.assertEqual('http://testserver/simple/target/?param1=foo¶m2=bar', response['Location'])
|
||||
|
||||
# Confirm that the contents of the query string are not subject to
|
||||
# string interpolation (Refs #17111):
|
||||
response = self.client.get('/simple/redirect_to_query/?param1=foo¶m2=hist%C3%B3ria')
|
||||
self.assertEqual(response.status_code, 301)
|
||||
self.assertEqual('http://testserver/simple/target/?param1=foo¶m2=hist%C3%B3ria', response['Location'])
|
||||
response = self.client.get('/simple/redirect_to_arg_and_query/99/?param1=foo¶m2=hist%C3%B3ria')
|
||||
self.assertEqual(response.status_code, 301)
|
||||
self.assertEqual('http://testserver/simple/target_arg/99/?param1=foo¶m2=hist%C3%B3ria', response['Location'])
|
||||
|
||||
def test_redirect_to_when_meta_contains_no_query_string(self):
|
||||
"regression for #16705"
|
||||
# we can't use self.client.get because it always sets QUERY_STRING
|
||||
response = self.client.request(PATH_INFO='/simple/redirect_to/')
|
||||
self.assertEqual(response.status_code, 301)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue