Commit 48018b36 authored by Georg Brandl's avatar Georg Brandl

Turn some comments into docstrings.

parent 9b4e645c
...@@ -226,12 +226,12 @@ _Translator = { ...@@ -226,12 +226,12 @@ _Translator = {
} }
def _quote(str, LegalChars=_LegalChars): def _quote(str, LegalChars=_LegalChars):
# r"""Quote a string for use in a cookie header.
# If the string does not need to be double-quoted,
# then just return the string. Otherwise, surround If the string does not need to be double-quoted, then just return the
# the string in doublequotes and precede quote (with a \) string. Otherwise, surround the string in doublequotes and quote
# special characters. (with a \) special characters.
# """
if all(c in LegalChars for c in str): if all(c in LegalChars for c in str):
return str return str
else: else:
...@@ -304,18 +304,15 @@ def _getdate(future=0, weekdayname=_weekdayname, monthname=_monthname): ...@@ -304,18 +304,15 @@ def _getdate(future=0, weekdayname=_weekdayname, monthname=_monthname):
(weekdayname[wd], day, monthname[month], year, hh, mm, ss) (weekdayname[wd], day, monthname[month], year, hh, mm, ss)
#
# A class to hold ONE key,value pair.
# In a cookie, each such pair may have several attributes.
# so this class is used to keep the attributes associated
# with the appropriate key,value pair.
# This class also includes a coded_value attribute, which
# is used to hold the network representation of the
# value. This is most useful when Python objects are
# pickled for network transit.
#
class Morsel(dict): class Morsel(dict):
"""A class to hold ONE key,value pair.
In a cookie, each such pair may have several attributes, so this class is
used to keep the attributes associated with the appropriate key,value pair.
This class also includes a coded_value attribute, which is used to hold
the network representation of the value. This is most useful when Python
objects are pickled for network transit.
"""
# RFC 2109 lists these attributes as reserved: # RFC 2109 lists these attributes as reserved:
# path comment domain # path comment domain
# max-age secure version # max-age secure version
...@@ -449,8 +446,7 @@ _CookiePattern = re.compile( ...@@ -449,8 +446,7 @@ _CookiePattern = re.compile(
# See this module's docstring for example usage. # See this module's docstring for example usage.
# #
class BaseCookie(dict): class BaseCookie(dict):
# A container class for a set of Morsels """A container class for a set of Morsels."""
#
def value_decode(self, val): def value_decode(self, val):
"""real_value, coded_value = value_decode(STRING) """real_value, coded_value = value_decode(STRING)
...@@ -551,7 +547,7 @@ class BaseCookie(dict): ...@@ -551,7 +547,7 @@ class BaseCookie(dict):
class SimpleCookie(BaseCookie): class SimpleCookie(BaseCookie):
"""SimpleCookie """
SimpleCookie supports strings as cookie values. When setting SimpleCookie supports strings as cookie values. When setting
the value using the dictionary assignment notation, SimpleCookie the value using the dictionary assignment notation, SimpleCookie
calls the builtin str() to convert the value to a string. Values calls the builtin str() to convert the value to a string. Values
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment