diff options
| author | Marten Kenbeek <marten.knbk@gmail.com> | 2015-06-20 13:05:35 +0200 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2015-06-20 18:52:33 -0400 |
| commit | 738c0de3000c5a1e287f10ddf2f99e0c5e127250 (patch) | |
| tree | 5c202fcf96ab503df6b8b092530d72804b837f8b /docs | |
| parent | 74402a5b0db83371d9dac512379d61c4d74262dd (diff) | |
Fixed #14200 -- Added a fallback if HttpRequest.urlconf is None.
Made BaseHandler fall back to settings.ROOT_URLCONF if
HttpRequest.urlconf is set to None, rather than raising
ImproperlyConfigured.
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/ref/request-response.txt | 8 | ||||
| -rw-r--r-- | docs/releases/1.9.txt | 4 | ||||
| -rw-r--r-- | docs/topics/http/urls.txt | 6 |
3 files changed, 15 insertions, 3 deletions
diff --git a/docs/ref/request-response.txt b/docs/ref/request-response.txt index eba47005a8..6656de5321 100644 --- a/docs/ref/request-response.txt +++ b/docs/ref/request-response.txt @@ -184,6 +184,14 @@ All attributes should be considered read-only, unless stated otherwise below. URLconf for the current request, overriding the :setting:`ROOT_URLCONF` setting. See :ref:`how-django-processes-a-request` for details. + ``urlconf`` can be set to ``None`` to revert any changes made by previous + middleware and return to using the :setting:`ROOT_URLCONF`. + + .. versionchanged:: 1.9 + + Setting ``urlconf=None`` raised + :exc:`~django.core.exceptions.ImproperlyConfigured` in older versions. + .. attribute:: HttpRequest.resolver_match An instance of :class:`~django.core.urlresolvers.ResolverMatch` representing diff --git a/docs/releases/1.9.txt b/docs/releases/1.9.txt index a8c0b960c7..02dba8d2df 100644 --- a/docs/releases/1.9.txt +++ b/docs/releases/1.9.txt @@ -435,6 +435,10 @@ Requests and Responses :class:`~django.template.response.TemplateResponse`, commonly used with class-based views. +* Request middleware can now set :attr:`HttpRequest.urlconf + <django.http.HttpRequest.urlconf>` to ``None`` to revert any changes made + by previous middleware and return to using the :setting:`ROOT_URLCONF`. + Tests ^^^^^ diff --git a/docs/topics/http/urls.txt b/docs/topics/http/urls.txt index aec8b74c3d..79b06dae15 100644 --- a/docs/topics/http/urls.txt +++ b/docs/topics/http/urls.txt @@ -40,9 +40,9 @@ algorithm the system follows to determine which Python code to execute: 1. Django determines the root URLconf module to use. Ordinarily, this is the value of the :setting:`ROOT_URLCONF` setting, but if the incoming - ``HttpRequest`` object has an attribute called ``urlconf`` (set by - middleware :ref:`request processing <request-middleware>`), its value - will be used in place of the :setting:`ROOT_URLCONF` setting. + ``HttpRequest`` object has a :attr:`~django.http.HttpRequest.urlconf` + attribute (set by middleware :ref:`request processing <request-middleware>`), + its value will be used in place of the :setting:`ROOT_URLCONF` setting. 2. Django loads that Python module and looks for the variable ``urlpatterns``. This should be a Python list of :func:`django.conf.urls.url` |
