diff options
author | Julia Iliuk <julia.iluyk@gmail.com> | 2019-05-07 17:05:20 (GMT) |
---|---|---|
committer | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2019-05-07 17:05:20 (GMT) |
commit | 91cc01f40eec03ece2d6b04ad9ea786e77707d8d (patch) | |
tree | 5f3bb8653a24fd58ffc601fc1bd2f175635af081 /Doc | |
parent | 64aa6d2000665efb1a2eccae176df9520bf5f5e6 (diff) | |
download | cpython-91cc01f40eec03ece2d6b04ad9ea786e77707d8d.zip cpython-91cc01f40eec03ece2d6b04ad9ea786e77707d8d.tar.gz cpython-91cc01f40eec03ece2d6b04ad9ea786e77707d8d.tar.bz2 |
bpo-11001: updated cookie docs (GH-13086)
Used **spookylukey**'s patch from 2011-01-24
https://bugs.python.org/issue11001
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/library/http.cookies.rst | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/Doc/library/http.cookies.rst b/Doc/library/http.cookies.rst index f3457a0..17792b2 100644 --- a/Doc/library/http.cookies.rst +++ b/Doc/library/http.cookies.rst @@ -55,8 +55,9 @@ in Cookie name (as :attr:`~Morsel.key`). .. class:: SimpleCookie([input]) This class derives from :class:`BaseCookie` and overrides :meth:`value_decode` - and :meth:`value_encode` to be the identity and :func:`str` respectively. - + and :meth:`value_encode`. SimpleCookie supports strings as cookie values. + When setting the value, SimpleCookie calls the builtin :func:`str()` to convert + the value to a string. Values received from HTTP are kept as strings. .. seealso:: @@ -76,15 +77,16 @@ Cookie Objects .. method:: BaseCookie.value_decode(val) - Return a decoded value from a string representation. Return value can be any - type. This method does nothing in :class:`BaseCookie` --- it exists so it can be - overridden. + Return a tuple ``(real_value, coded_value)`` from a string representation. + ``real_value`` can be any type. This method does no decoding in + :class:`BaseCookie` --- it exists so it can be overridden. .. method:: BaseCookie.value_encode(val) - Return an encoded value. *val* can be any type, but return value must be a - string. This method does nothing in :class:`BaseCookie` --- it exists so it can + Return a tuple ``(real_value, coded_value)``. *val* can be any type, but + ``coded_value`` will always be converted to a string. + This method does no encoding in :class:`BaseCookie` --- it exists so it can be overridden. In general, it should be the case that :meth:`value_encode` and |