Ticket #11960: 11960-1.diff
File 11960-1.diff, 1.3 KB (added by , 15 years ago) |
---|
-
django/shortcuts/__init__.py
49 49 try: 50 50 return redirect_class(urlresolvers.reverse(to, args=args, kwargs=kwargs)) 51 51 except urlresolvers.NoReverseMatch: 52 # If this is a callable, re-raise. 53 if callable(to): 54 raise 52 55 # If this doesn't "feel" like a URL, re-raise. 53 56 if '/' not in to and '.' not in to: 54 57 raise -
tests/regressiontests/urlpatterns_reverse/tests.py
160 160 res = redirect('http://example.com/') 161 161 self.assertEqual(res['Location'], 'http://example.com/') 162 162 163 def test_redirect_view_object(self): 164 from views import absolute_kwargs_view 165 res = redirect(absolute_kwargs_view) 166 self.assertEqual(res['Location'], '/absolute_arg_view/') 167 self.assertRaises(NoReverseMatch, redirect, absolute_kwargs_view, wrong_argument=None) 168 163 169 164 170 class NamespaceTests(TestCase): 165 171 urls = 'regressiontests.urlpatterns_reverse.namespace_urls'