Commits

Luke Plant committed 18ad8e1

[1.2.X] Fixed #13754 - Add a note about a test client session property gotcha

Thanks SmileyChris for report and patch.

Backport of [13685] from trunk.

  • Participants
  • Parent commits 858d41b
  • Branches releases/1.2.X

Comments (0)

Files changed (1)

File docs/topics/testing.txt

     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