Author: mtredinnick
Date: 2008-10-24 04:24:42 -0500 (Fri, 24 Oct 2008)
New Revision: 9266

Modified:
   django/trunk/docs/ref/request-response.txt
   django/trunk/docs/topics/http/views.txt
Log:
Fixed #9430 -- Fixed documentation references to the HttpResponse classes for
returning HTTP status codes other than 200.


Modified: django/trunk/docs/ref/request-response.txt
===================================================================
--- django/trunk/docs/ref/request-response.txt  2008-10-24 07:46:59 UTC (rev 
9265)
+++ django/trunk/docs/ref/request-response.txt  2008-10-24 09:24:42 UTC (rev 
9266)
@@ -525,6 +525,8 @@
 .. _HTTP Status code: 
http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10
 
 
+.. _ref-httpresponse-subclasses:
+
 HttpResponse subclasses
 -----------------------
 

Modified: django/trunk/docs/topics/http/views.txt
===================================================================
--- django/trunk/docs/topics/http/views.txt     2008-10-24 07:46:59 UTC (rev 
9265)
+++ django/trunk/docs/topics/http/views.txt     2008-10-24 09:24:42 UTC (rev 
9266)
@@ -64,11 +64,13 @@
 Returning errors
 ================
 
-Returning HTTP error codes in Django is easy. We've already mentioned the
-:class:`HttpResponseNotFound`, :class:`HttpResponseForbidden`,
-:class:`HttpResponseServerError`, etc., subclasses; just return an instance of 
one
-of those subclasses instead of a normal :class:`HttpResponse` in order to 
signify
-an error. For example::
+Returning HTTP error codes in Django is easy. There are subclasses of
+:class:`~django.http.HttpResponse` for a number of common HTTP status codes
+other than 200 (which means *"OK"*). You can find the full list of available
+subclasses in the :ref:`request/response <ref-httpresponse-subclasses>`
+documentation.  Just return an instance of one of those subclasses instead of
+a normal :class:`~django.http.HttpResponse` in order to signify an error. For
+example::
 
     def my_view(request):
         # ...
@@ -77,6 +79,18 @@
         else:
             return HttpResponse('<h1>Page was found</h1>')
 
+There isn't a specialized subclass for every possible HTTP response code,
+since many of them aren't going to be that common. However, as documented in
+the :class:`~django.http.HttpResponse` documentation, you can also pass the
+HTTP status code into the constructor for :class:`~django.http.HttpResponse`
+to create a return class for any status code you like. For example::
+
+    def my_view(request):
+        # ...
+
+        # Return a "created" (201) response code.
+        return HttpResponse(status=201)
+
 Because 404 errors are by far the most common HTTP error, there's an easier way
 to handle those errors.
 


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to