mirror of
https://github.com/python/cpython.git
synced 2025-09-27 02:39:58 +00:00
bpo-11001: updated cookie docs (GH-13086)
Used **spookylukey**'s patch from 2011-01-24 https://bugs.python.org/issue11001
This commit is contained in:
parent
64aa6d2000
commit
91cc01f40e
1 changed files with 9 additions and 7 deletions
|
@ -55,8 +55,9 @@ in Cookie name (as :attr:`~Morsel.key`).
|
||||||
.. class:: SimpleCookie([input])
|
.. class:: SimpleCookie([input])
|
||||||
|
|
||||||
This class derives from :class:`BaseCookie` and overrides :meth:`value_decode`
|
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::
|
.. seealso::
|
||||||
|
|
||||||
|
@ -76,15 +77,16 @@ Cookie Objects
|
||||||
|
|
||||||
.. method:: BaseCookie.value_decode(val)
|
.. method:: BaseCookie.value_decode(val)
|
||||||
|
|
||||||
Return a decoded value from a string representation. Return value can be any
|
Return a tuple ``(real_value, coded_value)`` from a string representation.
|
||||||
type. This method does nothing in :class:`BaseCookie` --- it exists so it can be
|
``real_value`` can be any type. This method does no decoding in
|
||||||
overridden.
|
:class:`BaseCookie` --- it exists so it can be overridden.
|
||||||
|
|
||||||
|
|
||||||
.. method:: BaseCookie.value_encode(val)
|
.. method:: BaseCookie.value_encode(val)
|
||||||
|
|
||||||
Return an encoded value. *val* can be any type, but return value must be a
|
Return a tuple ``(real_value, coded_value)``. *val* can be any type, but
|
||||||
string. This method does nothing in :class:`BaseCookie` --- it exists so it can
|
``coded_value`` will always be converted to a string.
|
||||||
|
This method does no encoding in :class:`BaseCookie` --- it exists so it can
|
||||||
be overridden.
|
be overridden.
|
||||||
|
|
||||||
In general, it should be the case that :meth:`value_encode` and
|
In general, it should be the case that :meth:`value_encode` and
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue