Author: ubernostrum
Date: 2011-09-10 21:06:29 -0700 (Sat, 10 Sep 2011)
New Revision: 16805
Modified:
django/branches/releases/1.3.X/docs/intro/tutorial03.txt
django/branches/releases/1.3.X/docs/topics/http/urls.txt
django/branches/releases/1.3.X/docs/topics/http/views.txt
Log:
[1.3.X] Fixed #16079: Clarified (for real this time) how handler404 and
handler500 work, and that they only work in a root URLconf. Backport of [16804]
from trunk.
Modified: django/branches/releases/1.3.X/docs/intro/tutorial03.txt
===================================================================
--- django/branches/releases/1.3.X/docs/intro/tutorial03.txt 2011-09-11
04:01:41 UTC (rev 16804)
+++ django/branches/releases/1.3.X/docs/intro/tutorial03.txt 2011-09-11
04:06:29 UTC (rev 16805)
@@ -357,11 +357,13 @@
Write a 404 (page not found) view
=================================
-When you raise :exc:`~django.http.Http404` from within a view, Django will load
-a special view devoted to handling 404 errors. It finds it by looking for the
-variable ``handler404``, which is a string in Python dotted syntax -- the same
-format the normal URLconf callbacks use. A 404 view itself has nothing special:
-It's just a normal view.
+When you raise :exc:`~django.http.Http404` from within a view, Django
+will load a special view devoted to handling 404 errors. It finds it
+by looking for the variable ``handler404`` in your root URLconf (and
+only in your root URLconf; setting ``handler404`` anywhere else will
+have no effect), which is a string in Python dotted syntax -- the same
+format the normal URLconf callbacks use. A 404 view itself has nothing
+special: It's just a normal view.
You normally won't have to bother with writing 404 views. By default, URLconfs
have the following line up top::
@@ -393,9 +395,9 @@
Write a 500 (server error) view
===============================
-Similarly, URLconfs may define a ``handler500``, which points to a view to call
-in case of server errors. Server errors happen when you have runtime errors in
-view code.
+Similarly, your root URLconf may define a ``handler500``, which points
+to a view to call in case of server errors. Server errors happen when
+you have runtime errors in view code.
Use the template system
=======================
Modified: django/branches/releases/1.3.X/docs/topics/http/urls.txt
===================================================================
--- django/branches/releases/1.3.X/docs/topics/http/urls.txt 2011-09-11
04:01:41 UTC (rev 16804)
+++ django/branches/releases/1.3.X/docs/topics/http/urls.txt 2011-09-11
04:06:29 UTC (rev 16805)
@@ -54,6 +54,10 @@
:class:`~django.http.HttpRequest` as its first argument and any values
captured in the regex as remaining arguments.
+ 5. If no regex matches, or if an exception is raised during any
+ point in this process, Django invokes an appropriate
+ error-handling view. See `Error handling`_ below.
+
Example
=======
@@ -246,6 +250,31 @@
``patterns()`` and is only relevant when you're passing a string as the
``view`` parameter.
+include
+-------
+
+.. function:: include(<module or pattern_list>)
+
+A function that takes a full Python import path to another URLconf module that
+should be "included" in this place.
+
+:func:`include` also accepts as an argument an iterable that returns URL
+patterns.
+
+See `Including other URLconfs`_ below.
+
+Error handling
+==============
+
+When Django can't find a regex matching the requested URL, or when an
+exception is raised, Django will invoke an error-handling view. The
+views to use for these cases are specified by two variables which can
+be set in your root URLconf. Setting these variables in any other
+URLconf will have no effect.
+
+See the documentation on :ref:`customizing error views
+<customizing-error-views>` for more details.
+
handler404
----------
@@ -275,19 +304,6 @@
.. versionchanged:: 1.2
Previous versions of Django only accepted strings representing import
paths.
-include
--------
-
-.. function:: include(<module or pattern_list>)
-
-A function that takes a full Python import path to another URLconf module that
-should be "included" in this place.
-
-:func:`include` also accepts as an argument an iterable that returns URL
-patterns.
-
-See `Including other URLconfs`_ below.
-
Notes on capturing text in URLs
===============================
Modified: django/branches/releases/1.3.X/docs/topics/http/views.txt
===================================================================
--- django/branches/releases/1.3.X/docs/topics/http/views.txt 2011-09-11
04:01:41 UTC (rev 16804)
+++ django/branches/releases/1.3.X/docs/topics/http/views.txt 2011-09-11
04:06:29 UTC (rev 16805)
@@ -122,6 +122,8 @@
template that is displayed when a 404 error is raised. This template should be
called ``404.html`` and located in the top level of your template tree.
+.. _customizing-error-views:
+
Customizing error views
=======================
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en.