summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorCarl Meyer <carl@oddbird.net>2010-10-10 02:16:33 +0000
committerCarl Meyer <carl@oddbird.net>2010-10-10 02:16:33 +0000
commit501546df6f4cbb56ea94da073e8206804fef3040 (patch)
tree767b30579c796b9fd9c94d1f8d30a4efb15d6d65 /docs
parentd084439c415e2037a1d13b217b044fd1bf3b39cb (diff)
Fixed #12226 -- Deprecated test client Response.template attribute in favor of templates attribute, which is always a list. Thanks Russell for patch review.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@14106 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'docs')
-rw-r--r--docs/internals/deprecation.txt6
-rw-r--r--docs/releases/1.3.txt17
-rw-r--r--docs/topics/testing.txt16
3 files changed, 32 insertions, 7 deletions
diff --git a/docs/internals/deprecation.txt b/docs/internals/deprecation.txt
index b313871128..edd3a1d2ec 100644
--- a/docs/internals/deprecation.txt
+++ b/docs/internals/deprecation.txt
@@ -102,6 +102,12 @@ their deprecation, as per the :ref:`Django deprecation policy
* The ``mod_python`` request handler has been deprecated since the 1.3
release. The ``mod_wsgi`` handler should be used instead.
+ * The ``template`` attribute on :class:`~django.test.client.Response`
+ objects returned by the :ref:`test client <test-client>` has been
+ deprecated since the 1.3 release. The
+ :attr:`~django.test.client.Response.templates` attribute should be
+ used instead.
+
* 2.0
* ``django.views.defaults.shortcut()``. This function has been moved
to ``django.contrib.contenttypes.views.shortcut()`` as part of the
diff --git a/docs/releases/1.3.txt b/docs/releases/1.3.txt
index 483fec6122..a494ec94df 100644
--- a/docs/releases/1.3.txt
+++ b/docs/releases/1.3.txt
@@ -106,6 +106,23 @@ If you are currently using the ``mod_python`` request handler, it is strongly
encouraged you redeploy your Django instances using :doc:`mod_wsgi
</howto/deployment/modwsgi>`.
+Test client response ``template`` attribute
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Django's :ref:`test client <test-client>` returns
+:class:`~django.test.client.Response` objects annotated with extra testing
+information. In Django versions prior to 1.3, this included a
+:attr:`~django.test.client.Response.template` attribute containing information
+about templates rendered in generating the response: either None, a single
+:class:`~django.template.Template` object, or a list of
+:class:`~django.template.Template` objects. This inconsistency in return values
+(sometimes a list, sometimes not) made the attribute difficult to work with.
+
+In Django 1.3 the :attr:`~django.test.client.Response.template` attribute is
+deprecated in favor of a new :attr:`~django.test.client.Response.templates`
+attribute, which is always a list, even if it has only a single element or no
+elements.
+
What's new in Django 1.3
========================
diff --git a/docs/topics/testing.txt b/docs/topics/testing.txt
index 28411ab05f..8a19d38f22 100644
--- a/docs/topics/testing.txt
+++ b/docs/topics/testing.txt
@@ -494,6 +494,8 @@ Testing tools
Django provides a small set of tools that come in handy when writing tests.
+.. _test-client:
+
The test client
---------------
@@ -894,15 +896,15 @@ Specifically, a ``Response`` object has the following attributes:
The HTTP status of the response, as an integer. See RFC2616_ for a full
list of HTTP status codes.
- .. attribute:: template
+ .. versionadded:: 1.3
+
+ .. attribute:: templates
- The ``Template`` instance that was used to render the final content. Use
+ A list of ``Template`` instances used to render the final content, in
+ the order they were rendered. For each template in the list, use
``template.name`` to get the template's file name, if the template was
- loaded from a file. (The name is a string such as ``'admin/index.html'``.)
-
- If the rendered page used multiple templates -- e.g., using :ref:`template
- inheritance<template-inheritance>` -- then ``template`` will be a list of
- ``Template`` instances, in the order in which they were rendered.
+ loaded from a file. (The name is a string such as
+ ``'admin/index.html'``.)
You can also use dictionary syntax on the response object to query the value
of any settings in the HTTP headers. For example, you could determine the