Ticket #13277: http-303-redirect-backward-compatible.diff
File http-303-redirect-backward-compatible.diff, 3.4 KB (added by , 14 years ago) |
---|
-
django/conf/global_settings.py
395 395 DEFAULT_TABLESPACE = '' 396 396 DEFAULT_INDEX_TABLESPACE = '' 397 397 398 # HTTP 303 ("see other") redirects were introduced in HTTP 1.1 and as such 399 # might not work correctly with very old browsers. Setting this to True 400 # lets HttpResponseSeeOtherRedirect objects return the status code 302 401 # instead of 303. 402 REDIRECT_303_BACKWARD_COMPATIBILITY = True 403 398 404 ############## 399 405 # MIDDLEWARE # 400 406 ############## -
django/http/__init__.py
607 607 HttpResponse.__init__(self) 608 608 self['Location'] = iri_to_uri(redirect_to) 609 609 610 class HttpResponseSeeOtherRedirect(HttpResponse): 611 def status_code(self): 612 return settings.REDIRECT_303_BACKWARD_COMPATIBILITY and 302 or 303 613 status_code = property(status_code) 614 615 def __init__(self, redirect_to): 616 HttpResponse.__init__(self) 617 self['Location'] = iri_to_uri(redirect_to) 618 610 619 class HttpResponseNotModified(HttpResponse): 611 620 status_code = 304 612 621 -
docs/ref/request-response.txt
663 663 Like :class:`HttpResponseRedirect`, but it returns a permanent redirect 664 664 (HTTP status code 301) instead of a "found" redirect (status code 302). 665 665 666 .. class:: HttpResponseSeeOtherRedirect 667 668 Like :class:`HttpResponseRedirect`, but it returns a "see other" 669 (HTTP status code 303) instead of a "found" redirect (status code 302). 670 This is the preferred redirect method in the `post-redirect-get pattern`_. 671 666 672 .. class:: HttpResponseNotModified 667 673 668 674 The constructor doesn't take any arguments. Use this to designate that a … … 692 698 .. class:: HttpResponseServerError 693 699 694 700 Acts just like :class:`HttpResponse` but uses a 500 status code. 701 702 .. _post-redirect-get pattern: http://en.wikipedia.org/wiki/Post/Redirect/Get -
docs/ref/settings.txt
1380 1380 A tuple of profanities, as strings, that will trigger a validation error when 1381 1381 the ``hasNoProfanities`` validator is called. 1382 1382 1383 .. setting:: REDIRECT_303_BACKWARD_COMPATIBILITY 1384 1385 REDIRECT_303_BACKWARD_COMPATIBILITY 1386 ----------------------------------- 1387 1388 Default: ``True`` 1389 1390 Whether to replace ``HttpResponseSeeOtherRedirect`` (HTTP 303) redirects with 1391 the status code 302 ("found"). The status code 303 ("see other") was introduced 1392 in HTTP 1.1 and might not be understood by very old clients or clients that only 1393 understand HTTP 1.0. 1394 1395 This setting does only apply to ``HttpResponseSeeOtherRedirect`` objects. It 1396 does not affect other (custom) response objects, for example responses with 1397 the attribute ``status_code = 303``. 1398 1399 If targeted clients are expected to understand HTTP 1.1 and/or the status code 1400 303, this setting can be changed to ``False`` in order to leave the status code 1401 303 untouched. 1402 1383 1403 .. setting:: RESTRUCTUREDTEXT_FILTER_SETTINGS 1384 1404 1385 1405 RESTRUCTUREDTEXT_FILTER_SETTINGS