~ubuntu-branches/ubuntu/quantal/python-django/quantal-security

« back to all changes in this revision

Viewing changes to docs/topics/http/urls.txt

  • Committer: Bazaar Package Importer
  • Author(s): Chris Lamb
  • Date: 2010-05-21 07:52:55 UTC
  • mfrom: (1.3.6 upstream)
  • mto: This revision was merged to the branch mainline in revision 28.
  • Revision ID: james.westby@ubuntu.com-20100521075255-ii78v1dyfmyu3uzx
Tags: upstream-1.2
ImportĀ upstreamĀ versionĀ 1.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
40
40
 
41
41
    1. Django determines the root URLconf module to use. Ordinarily,
42
42
       this is the value of the ``ROOT_URLCONF`` setting, but if the incoming
43
 
       ``HttpRequest`` object has an attribute called ``urlconf``, its value
 
43
       ``HttpRequest`` object has an attribute called ``urlconf`` (set by
 
44
       middleware :ref:`request processing <request-middleware>`), its value
44
45
       will be used in place of the ``ROOT_URLCONF`` setting.
45
46
 
46
47
    2. Django loads that Python module and looks for the variable
252
253
 
253
254
.. data:: handler404
254
255
 
255
 
A string representing the full Python import path to the view that should be
256
 
called if none of the URL patterns match.
 
256
A callable, or a string representing the full Python import path to the view
 
257
that should be called if none of the URL patterns match.
257
258
 
258
259
By default, this is ``'django.views.defaults.page_not_found'``. That default
259
260
value should suffice.
260
261
 
 
262
.. versionchanged:: 1.2
 
263
    Previous versions of Django only accepted strings representing import paths.
 
264
 
261
265
handler500
262
266
----------
263
267
 
264
268
.. data:: handler500
265
269
 
266
 
A string representing the full Python import path to the view that should be
267
 
called in case of server errors. Server errors happen when you have runtime
268
 
errors in view code.
 
270
A callable, or a string representing the full Python import path to the view
 
271
that should be called in case of server errors. Server errors happen when you
 
272
have runtime errors in view code.
269
273
 
270
274
By default, this is ``'django.views.defaults.server_error'``. That default
271
275
value should suffice.
272
276
 
 
277
.. versionchanged:: 1.2
 
278
    Previous versions of Django only accepted strings representing import paths.
 
279
 
273
280
include
274
281
-------
275
282
 
721
728
       that has an instance namespace matching the application namespace (in
722
729
       this example, an instance of the ``myapp`` called ``myapp``).
723
730
 
724
 
    4. If there is no default application instance, Django will pick the first
 
731
    4. If there is no default application instance, Django will pick the last
725
732
       deployed instance of the application, whatever its instance name may be.
726
733
 
727
734
    5. If the provided namespace doesn't match an application namespace in
742
749
      the instance ``bar``.
743
750
 
744
751
    * If there is no current instance - say, if we were rendering a page
745
 
      somewhere else on the site - ``myapp:index`` will resolve to the first
 
752
      somewhere else on the site - ``myapp:index`` will resolve to the last
746
753
      registered instance of ``myapp``. Since there is no default instance,
747
 
      the first instance of ``myapp`` that is registered will be used. This could
 
754
      the last instance of ``myapp`` that is registered will be used. This could
748
755
      be ``foo`` or ``bar``, depending on the order they are introduced into the
749
756
      urlpatterns of the project.
750
757