Author: lukeplant
Date: 2010-09-03 14:00:43 -0500 (Fri, 03 Sep 2010)
New Revision: 13685
Modified:
django/trunk/docs/topics/testing.txt
Log:
Fixed #13754 - Add a note about a test client session property gotcha
Thanks SmileyChris for report and patch.
Modified: django/trunk/docs/topics/testing.txt
===================================================================
--- django/trunk/docs/topics/testing.txt 2010-09-03 18:58:53 UTC (rev
13684)
+++ django/trunk/docs/topics/testing.txt 2010-09-03 19:00:43 UTC (rev
13685)
@@ -935,6 +935,15 @@
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
--
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.