summaryrefslogtreecommitdiff
path: root/django/contrib
diff options
context:
space:
mode:
authorChris Beaven <smileychris@gmail.com>2010-12-01 22:25:17 +0000
committerChris Beaven <smileychris@gmail.com>2010-12-01 22:25:17 +0000
commitdceaa82dec9f97ac77754dfdc737852d8171c8a2 (patch)
treef24cbd8cf821e5b0990d02d541d0ce42c2976a8a /django/contrib
parentcd847db17fbb578c580c54ac41dcb899ef3b9cb0 (diff)
Fixed #14809 -- broken login related tests after r14733.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@14764 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/contrib')
-rw-r--r--django/contrib/auth/tests/views.py13
-rw-r--r--django/contrib/auth/views.py2
2 files changed, 8 insertions, 7 deletions
diff --git a/django/contrib/auth/tests/views.py b/django/contrib/auth/tests/views.py
index 88867d538c..014c8195fc 100644
--- a/django/contrib/auth/tests/views.py
+++ b/django/contrib/auth/tests/views.py
@@ -265,7 +265,7 @@ class LoginURLSettings(AuthViewsTestCase):
querystring = QueryDict('', mutable=True)
querystring['next'] = '/login_required/'
self.assertEqual(login_required_url,
- 'http://testserver%s?%s' % (login_url, querystring.urlencode()))
+ 'http://testserver%s?%s' % (login_url, querystring.urlencode('/')))
def test_remote_login_url(self):
login_url = 'http://remote.example.com/login'
@@ -273,7 +273,7 @@ class LoginURLSettings(AuthViewsTestCase):
querystring = QueryDict('', mutable=True)
querystring['next'] = 'http://testserver/login_required/'
self.assertEqual(login_required_url,
- '%s?%s' % (login_url, querystring.urlencode()))
+ '%s?%s' % (login_url, querystring.urlencode('/')))
def test_https_login_url(self):
login_url = 'https:///login/'
@@ -281,7 +281,7 @@ class LoginURLSettings(AuthViewsTestCase):
querystring = QueryDict('', mutable=True)
querystring['next'] = 'http://testserver/login_required/'
self.assertEqual(login_required_url,
- '%s?%s' % (login_url, querystring.urlencode()))
+ '%s?%s' % (login_url, querystring.urlencode('/')))
def test_login_url_with_querystring(self):
login_url = '/login/?pretty=1'
@@ -289,7 +289,7 @@ class LoginURLSettings(AuthViewsTestCase):
querystring = QueryDict('pretty=1', mutable=True)
querystring['next'] = '/login_required/'
self.assertEqual(login_required_url, 'http://testserver/login/?%s' %
- querystring.urlencode())
+ querystring.urlencode('/'))
def test_remote_login_url_with_next_querystring(self):
login_url = 'http://remote.example.com/login/'
@@ -298,8 +298,9 @@ class LoginURLSettings(AuthViewsTestCase):
querystring = QueryDict('', mutable=True)
querystring['next'] = 'http://testserver/login_required/'
self.assertEqual(login_required_url, '%s?%s' % (login_url,
- querystring.urlencode()))
-
+ querystring.urlencode('/')))
+
+
class LogoutTest(AuthViewsTestCase):
urls = 'django.contrib.auth.tests.urls'
diff --git a/django/contrib/auth/views.py b/django/contrib/auth/views.py
index 42ad68d3c3..0325643c11 100644
--- a/django/contrib/auth/views.py
+++ b/django/contrib/auth/views.py
@@ -99,7 +99,7 @@ def redirect_to_login(next, login_url=None,
if redirect_field_name:
querystring = QueryDict(login_url_parts[4], mutable=True)
querystring[redirect_field_name] = next
- login_url_parts[4] = querystring.urlencode()
+ login_url_parts[4] = querystring.urlencode(safe='/')
return HttpResponseRedirect(urlparse.urlunparse(login_url_parts))