diff options
| author | Casey Duncan <casey.duncan@gmail.com> | 2010-12-12 10:35:53 -0700 |
|---|---|---|
| committer | Casey Duncan <casey.duncan@gmail.com> | 2010-12-12 10:35:53 -0700 |
| commit | 729fd3f16ab77c7c56c73d0a79406473cd7b8b80 (patch) | |
| tree | 41901a8459f301c30050bccb9258802d07360d13 /docs | |
| parent | 8d2478d5aecc5eeb3d6a58f49cc130c4a342054d (diff) | |
| download | pyramid-729fd3f16ab77c7c56c73d0a79406473cd7b8b80.tar.gz pyramid-729fd3f16ab77c7c56c73d0a79406473cd7b8b80.tar.bz2 pyramid-729fd3f16ab77c7c56c73d0a79406473cd7b8b80.zip | |
clarify paragraph about when to call ISession.changed
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/narr/sessions.rst | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/docs/narr/sessions.rst b/docs/narr/sessions.rst index c7952bd06..8d057bdd1 100644 --- a/docs/narr/sessions.rst +++ b/docs/narr/sessions.rst @@ -117,15 +117,14 @@ Some gotchas: pickleable, an error will be raised when the session is serialized. - If you place a mutable value (for example, a list or a dictionary) - in a session object, and you subsequently mutate that value, you - must call the ``changed()`` method of the session object. This is - because, although the session object can detect when you call its - data-modifying methods such as ``__setitem__``, ``pop`` and other - (and thus the session knows it needs to reserialize the session - data), when you change a mutable object stored in the session - itself, the session has no way to know that you changed that value. - When in doubt, call ``changed()`` after you've changed sessioning - data. + in a session object, and you subsequently mutate that value, you must + call the ``changed()`` method of the session object. In this case, the + session has no way to know that is was modified. However, when you + modify a session object directly, such as setting a value (i.e., + ``__setitem__``), or removing a key (e.g., ``del`` or ``pop``), the + session will automatically know that it needs to re-serialize its + data, thus calling ``changed()`` is unnecessary. When in doubt, call + ``changed()`` after you've changed sessioning data. .. index:: single: pyramid_beaker |
