summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorLuke Plant <L.Plant.98@cantab.net>2010-09-03 19:00:43 +0000
committerLuke Plant <L.Plant.98@cantab.net>2010-09-03 19:00:43 +0000
commit027aaca37f25d866a87a6426fa197813f75051cf (patch)
tree5d1979078c921fc94910917fd702caeb4a458dec /docs
parentbdd13a4daaf2471c851f538a76e86010a968d24d (diff)
Fixed #13754 - Add a note about a test client session property gotcha
Thanks SmileyChris for report and patch. git-svn-id: http://code.djangoproject.com/svn/django/trunk@13685 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'docs')
-rw-r--r--docs/topics/testing.txt9
1 files changed, 9 insertions, 0 deletions
diff --git a/docs/topics/testing.txt b/docs/topics/testing.txt
index 8fb89d2d7a..5c1933c946 100644
--- a/docs/topics/testing.txt
+++ b/docs/topics/testing.txt
@@ -935,6 +935,15 @@ can access these properties as part of a test condition.
A dictionary-like object containing session information. See the
:doc:`session documentation</topics/http/sessions>` for full details.
+ To modify the session and then save it, it must be stored in a variable
+ first (because a new ``SessionStore`` is created every time this property
+ is accessed)::
+
+ def test_something(self):
+ session = self.client.session
+ session['somekey'] = 'test'
+ session.save()
+
.. _Cookie module documentation: http://docs.python.org/library/cookie.html
Example