Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions Lib/http/cookies.py
Original file line number Diff line number Diff line change
Expand Up @@ -598,15 +598,19 @@ def __parse_string(self, str, patt=_CookiePattern):


class SimpleCookie(BaseCookie):
"""
SimpleCookie supports strings as cookie values. When setting
"""SimpleCookie supports strings as cookie values. When setting
the value using the dictionary assignment notation, SimpleCookie
calls the builtin str() to convert the value to a string. Values
received from HTTP are kept as strings.
"""
def value_decode(self, val):
"""Return an unquoted string, from the cookie header in a reversed fasion of value_encode.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a typo:

Suggested change
"""Return an unquoted string, from the cookie header in a reversed fasion of value_encode.
"""Return an unquoted string, from the cookie header in a reversed fashion of value_encode.

And this line width is larger than 80, we should break it.

"""
return _unquote(val), val

def value_encode(self, val):
"""Return an escaped quoted string, if needed, for the cookie header usage.
Will include non-compliant characters in the cookie value if exist.
"""
strval = str(val)
return strval, _quote(strval)
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
added documentation to `SimpleCookie.value_decode` and `SimpleCookie.value_encode`

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to the Dev Guide https://devguide.python.org/contrib/core-team/committing/#changes-that-require-news-entries, docs changes don't requires a news entry file.

Loading