WebUtils.Cookie | index /usr/local/share/webware/WebUtils/Cookie.py

`Here's a sample session to show how to use this module.
At the moment, this is the only documentation.
The Basics
----------
Importing is easy..
>>> import Cookie
Most of the time you start by creating a cookie. Cookies come in
three flavors, each with slighly different encoding semanitcs, but
more on that later.
>>> C = Cookie.SimpleCookie()
>>> C = Cookie.SerialCookie()
>>> C = Cookie.SmartCookie()
[Note: Long-time users of Cookie.py will remember using
Cookie.Cookie() to create an Cookie object. Although deprecated, it
is still supported by the code. See the Backward Compatibility notes
for more information.]
Once you've created your Cookie, you can add values just as if it were
a dictionary.
>>> C = Cookie.SmartCookie()
>>> C["fig"] = "newton"
>>> C["sugar"] = "wafer"
>>> print C
Set-Cookie: fig=newton;
Set-Cookie: sugar=wafer;
Notice that the printable representation of a Cookie is the
appropriate format for a Set-Cookie: header. This is the
default behavior. You can change the header and printed
attributes by using the the .output() function
>>> C = Cookie.SmartCookie()
>>> C["rocky"] = "road"
>>> C["rocky"]["path"] = "/cookie"
>>> print C.output(header="Cookie:")
Cookie: rocky=road; Path=/cookie;
>>> print C.output(attrs=[], header="Cookie:")
Cookie: rocky=road;
The load() method of a Cookie extracts cookies from a string. In a
CGI script, you would use this method to extract the cookies from the
HTTP_COOKIE environment variable.
>>> C = Cookie.SmartCookie()
>>> C.load("chips=ahoy; vienna=finger")
>>> print C
Set-Cookie: chips=ahoy;
Set-Cookie: vienna=finger;
The load() method is darn-tootin smart about identifying cookies
within a string. Escaped quotation marks, nested semicolons, and other
such trickeries do not confuse it.
>>> C = Cookie.SmartCookie()
>>> C.load('keebler="E=everybody; L=\\"Loves\\"; fudge=\\012;";')
>>> print C
Set-Cookie: keebler="E=everybody; L=\"Loves\"; fudge=\012;";
Each element of the Cookie also supports all of the RFC 2109
Cookie attributes. Here's an example which sets the Path
attribute.
>>> C = Cookie.SmartCookie()
>>> C["oreo"] = "doublestuff"
>>> C["oreo"]["path"] = "/"
>>> print C
Set-Cookie: oreo=doublestuff; Path=/;
Each dictionary element has a 'value' attribute, which gives you
back the value associated with the key.
>>> C = Cookie.SmartCookie()
>>> C["twix"] = "none for you"
>>> C["twix"].value
'none for you'
A Bit More Advanced
-------------------
As mentioned before, there are three different flavors of Cookie
objects, each with different encoding/decoding semantics. This
section briefly discusses the differences.
SimpleCookie
The SimpleCookie expects that all values should be standard strings.
Just to be sure, SimpleCookie invokes the str() builtin to convert
the value to a string, when the values are set dictionary-style.
>>> C = Cookie.SimpleCookie()
>>> C["number"] = 7
>>> C["string"] = "seven"
>>> C["number"].value
'7'
>>> C["string"].value
'seven'
>>> print C
Set-Cookie: number=7;
Set-Cookie: string=seven;
SerialCookie
The SerialCookie expects that all values should be serialized using
cPickle (or pickle, if cPickle isn't available). As a result of
serializing, SerialCookie can save almost any Python object to a
value, and recover the exact same object when the cookie has been
returned. (SerialCookie can yield some strange-looking cookie
values, however.)
>>> C = Cookie.SerialCookie()
>>> C["number"] = 7
>>> C["string"] = "seven"
>>> C["number"].value
7
>>> C["string"].value
'seven'
>>> print C
Set-Cookie: number="I7\012.";
Set-Cookie: string="S'seven'\012p1\012.";
Be warned, however, if SerialCookie cannot de-serialize a value (because
it isn't a valid pickle'd object), IT WILL RAISE AN EXCEPTION.
SmartCookie
The SmartCookie combines aspects of each of the other two flavors.
When setting a value in a dictionary-fashion, the SmartCookie will
serialize (ala cPickle) the value *if and only if* it isn't a
Python string. String objects are *not* serialized. Similarly,
when the load() method parses out values, it attempts to de-serialize
the value. If it fails, then it fallsback to treating the value
as a string.
>>> C = Cookie.SmartCookie()
>>> C["number"] = 7
>>> C["string"] = "seven"
>>> C["number"].value
7
>>> C["string"].value
'seven'
>>> print C
Set-Cookie: number="I7\012.";
Set-Cookie: string=seven;
Backwards Compatibility
-----------------------
In order to keep compatibilty with earlier versions of Cookie.py,
it is still possible to use Cookie.Cookie() to create a Cookie. In
fact, this simply returns a SmartCookie.
>>> C = Cookie.Cookie()
>>> print C.__class__.__name__
SmartCookie
Finis.`

Modules
`` |  |
re | string |  |

Classes
`` |  | UserDict.UserDict(MiscUtils.NamedValueAccess.NamedValueAccess) BaseCookie SerialCookie SimpleCookie SmartCookie SmartCookie exceptions.Exception(exceptions.BaseException) CookieError
class BaseCookie(UserDict.UserDict)
`` | `# At long last, here is the cookie class. # Using this class is almost just like using a dictionary. # See this module's docstring for example usage.`
| Method resolution order: BaseCookie UserDict.UserDict MiscUtils.NamedValueAccess.NamedValueAccess Methods defined here: __init__(self, input=None) __repr__(self) __setitem__(self, key, value) `Dictionary style assignment.` __str__ = output(self, attrs=None, header='Set-Cookie:', sep='\n') js_output(self, attrs=None) `Return a string suitable for JavaScript.` load(self, rawdata) `Load cookies from a string (presumably HTTP_COOKIE) or from a dictionary. Loading cookies from a dictionary 'd' is equivalent to calling: map(Cookie.__setitem__, d.keys(), d.values())` output(self, attrs=None, header='Set-Cookie:', sep='\n') `Return a string suitable for HTTP.` value_decode(self, val) `real_value, coded_value = value_decode(STRING) Called prior to setting a cookie's value from the network representation. The VALUE is the value read from HTTP header. Override this function to modify the behavior of cookies.` value_encode(self, val) `real_value, coded_value = value_encode(VALUE) Called prior to setting a cookie's value from the dictionary representation. The VALUE is the value being assigned. Override this function to modify the behavior of cookies.` Methods inherited from UserDict.UserDict: __cmp__(self, dict) __contains__(self, key) __delitem__(self, key) __getitem__(self, key) __len__(self) clear(self) copy(self) get(self, key, failobj=None) hasValueForKey = _UserDict_hasValueForKey(self, key) has_key(self, key) items(self) iteritems(self) iterkeys(self) itervalues(self) keys(self) pop(self, key, *args) popitem(self) setdefault(self, key, failobj=None) update(self, dict=None, **kwargs) valueForKey = _UserDict_valueForKey(self, key, default=<class MiscUtils.NoDefault at 0x4842f9bc>) values(self) Class methods inherited from UserDict.UserDict: fromkeys(cls, iterable, value=None) from __builtin__.classobj Methods inherited from MiscUtils.NamedValueAccess.NamedValueAccess: handleUnknownSetKey(self, key) hasValueForName(self, keysString) `Check whether name is available.` resetKeyBindings(self) `Rest all key bindings, releasing alreaedy referenced values.` setValueForKey(self, key, value) `Set value for a given key. Suppose key is 'foo'. This method sets the value with the following precedence: 1. Public attributes before private attributes 2. Methods before non-methods More specifically, this method then uses one of the following: @@ 2000-03-04 ce: fill in ... or invokes handleUnknownSetKey().` valueForKeySequence(self, listOfKeys, default=None) `Get the value for the given list of keys.` valueForName(self, keysString, default=None) `Get the value for the given keysString. This is the more advanced version of valueForKey(), which can only handle single names. This method can handle 'foo', 'foo1.foo2', 'a.b.c.d', etc. It will traverse dictionaries if needed.` valueForUnknownKey(self, key, default) valuesForNames(self, keys, default=None, defaults=None, forgive=0, includeNames=0) `Get all values for given names. Returns a list of values that match the given keys, each of which is passed through valueForName() and so could be of the form 'a.b.c'. keys and defaults are sequences. default is any kind of object. forgive and includeNames are flags. If default is not None, then it is substituted when a key is not found. Otherwise, if defaults is not None, then it's corresponding/parallel value for the current key is substituted when a key is not found. Otherwise, if forgive is true, then unknown keys simply don't produce any values. Otherwise, if default and defaults are None, and forgive is false, then the unknown keys will probably raise an exception through valueForUnknownKey() although that method can always return a final, default value. if keys is None, then None is returned. If keys is an empty list, then None is returned. Often these last four arguments are specified by key. Examples: names = ['origin.x', 'origin.y', 'size.width', 'size.height'] obj.valuesForNames(names) obj.valuesForNames(names, default=0.0) obj.valuesForNames(names, defaults=[0.0, 0.0, 100.0, 100.0]) obj.valuesForNames(names, forgive=0) @@ 2000-03-04 ce: includeNames is only supported when forgive=1. It should be supported for the other cases. It should be documented. It should be included in the test cases.`
Cookie = class SmartCookie(BaseCookie)
`` | `SmartCookie SmartCookie supports arbitrary objects as cookie values. If the object is a string, then it is quoted. If the object is not a string, however, then SmartCookie will use cPickle to serialize the object into a string representation. Note: Large cookie values add overhead because they must be retransmitted on every HTTP transaction. Note: HTTP has a 2k limit on the size of a cookie. This class does not check for this limit, so be careful!!!`
| Method resolution order: SmartCookie BaseCookie UserDict.UserDict MiscUtils.NamedValueAccess.NamedValueAccess Methods defined here: value_decode(self, val) value_encode(self, val) Methods inherited from BaseCookie: __init__(self, input=None) __repr__(self) __setitem__(self, key, value) `Dictionary style assignment.` __str__ = output(self, attrs=None, header='Set-Cookie:', sep='\n') `Return a string suitable for HTTP.` js_output(self, attrs=None) `Return a string suitable for JavaScript.` load(self, rawdata) `Load cookies from a string (presumably HTTP_COOKIE) or from a dictionary. Loading cookies from a dictionary 'd' is equivalent to calling: map(Cookie.__setitem__, d.keys(), d.values())` output(self, attrs=None, header='Set-Cookie:', sep='\n') `Return a string suitable for HTTP.` Methods inherited from UserDict.UserDict: __cmp__(self, dict) __contains__(self, key) __delitem__(self, key) __getitem__(self, key) __len__(self) clear(self) copy(self) get(self, key, failobj=None) hasValueForKey = _UserDict_hasValueForKey(self, key) has_key(self, key) items(self) iteritems(self) iterkeys(self) itervalues(self) keys(self) pop(self, key, *args) popitem(self) setdefault(self, key, failobj=None) update(self, dict=None, **kwargs) valueForKey = _UserDict_valueForKey(self, key, default=<class MiscUtils.NoDefault at 0x4842f9bc>) values(self) Class methods inherited from UserDict.UserDict: fromkeys(cls, iterable, value=None) from __builtin__.classobj Methods inherited from MiscUtils.NamedValueAccess.NamedValueAccess: handleUnknownSetKey(self, key) hasValueForName(self, keysString) `Check whether name is available.` resetKeyBindings(self) `Rest all key bindings, releasing alreaedy referenced values.` setValueForKey(self, key, value) `Set value for a given key. Suppose key is 'foo'. This method sets the value with the following precedence: 1. Public attributes before private attributes 2. Methods before non-methods More specifically, this method then uses one of the following: @@ 2000-03-04 ce: fill in ... or invokes handleUnknownSetKey().` valueForKeySequence(self, listOfKeys, default=None) `Get the value for the given list of keys.` valueForName(self, keysString, default=None) `Get the value for the given keysString. This is the more advanced version of valueForKey(), which can only handle single names. This method can handle 'foo', 'foo1.foo2', 'a.b.c.d', etc. It will traverse dictionaries if needed.` valueForUnknownKey(self, key, default) valuesForNames(self, keys, default=None, defaults=None, forgive=0, includeNames=0) `Get all values for given names. Returns a list of values that match the given keys, each of which is passed through valueForName() and so could be of the form 'a.b.c'. keys and defaults are sequences. default is any kind of object. forgive and includeNames are flags. If default is not None, then it is substituted when a key is not found. Otherwise, if defaults is not None, then it's corresponding/parallel value for the current key is substituted when a key is not found. Otherwise, if forgive is true, then unknown keys simply don't produce any values. Otherwise, if default and defaults are None, and forgive is false, then the unknown keys will probably raise an exception through valueForUnknownKey() although that method can always return a final, default value. if keys is None, then None is returned. If keys is an empty list, then None is returned. Often these last four arguments are specified by key. Examples: names = ['origin.x', 'origin.y', 'size.width', 'size.height'] obj.valuesForNames(names) obj.valuesForNames(names, default=0.0) obj.valuesForNames(names, defaults=[0.0, 0.0, 100.0, 100.0]) obj.valuesForNames(names, forgive=0) @@ 2000-03-04 ce: includeNames is only supported when forgive=1. It should be supported for the other cases. It should be documented. It should be included in the test cases.`
class CookieError(exceptions.Exception)
`` | `# Define an exception visible to External modules`
| Method resolution order: CookieError exceptions.Exception exceptions.BaseException __builtin__.object Data descriptors defined here: __weakref__ `list of weak references to the object (if defined)` Methods inherited from exceptions.Exception: __init__(...) `x.__init__(...) initializes x; see x.__class__.__doc__ for signature` Data and other attributes inherited from exceptions.Exception: __new__ = <built-in method __new__ of type object at 0x8118bc0> `T.__new__(S, ...) -> a new object with type S, a subtype of T` Methods inherited from exceptions.BaseException: __delattr__(...) `x.__delattr__('name') <==> del x.name` __getattribute__(...) `x.__getattribute__('name') <==> x.name` __getitem__(...) `x.__getitem__(y) <==> x[y]` __getslice__(...) `x.__getslice__(i, j) <==> x[i:j] Use of negative indices is not supported.` __reduce__(...) __repr__(...) `x.__repr__() <==> repr(x)` __setattr__(...) `x.__setattr__('name', value) <==> x.name = value` __setstate__(...) __str__(...) `x.__str__() <==> str(x)` Data descriptors inherited from exceptions.BaseException: __dict__ args message `exception message`
class SerialCookie(BaseCookie)
`` | `SerialCookie SerialCookie supports arbitrary objects as cookie values. All values are serialized (using cPickle) before being sent to the client. All incoming values are assumed to be valid Pickle representations. IF AN INCOMING VALUE IS NOT IN A VALID PICKLE FORMAT, THEN AN EXCEPTION WILL BE RAISED. Note: Large cookie values add overhead because they must be retransmitted on every HTTP transaction. Note: HTTP has a 2k limit on the size of a cookie. This class does not check for this limit, so be careful!!!`
| Method resolution order: SerialCookie BaseCookie UserDict.UserDict MiscUtils.NamedValueAccess.NamedValueAccess Methods defined here: value_decode(self, val) value_encode(self, val) Methods inherited from BaseCookie: __init__(self, input=None) __repr__(self) __setitem__(self, key, value) `Dictionary style assignment.` __str__ = output(self, attrs=None, header='Set-Cookie:', sep='\n') `Return a string suitable for HTTP.` js_output(self, attrs=None) `Return a string suitable for JavaScript.` load(self, rawdata) `Load cookies from a string (presumably HTTP_COOKIE) or from a dictionary. Loading cookies from a dictionary 'd' is equivalent to calling: map(Cookie.__setitem__, d.keys(), d.values())` output(self, attrs=None, header='Set-Cookie:', sep='\n') `Return a string suitable for HTTP.` Methods inherited from UserDict.UserDict: __cmp__(self, dict) __contains__(self, key) __delitem__(self, key) __getitem__(self, key) __len__(self) clear(self) copy(self) get(self, key, failobj=None) hasValueForKey = _UserDict_hasValueForKey(self, key) has_key(self, key) items(self) iteritems(self) iterkeys(self) itervalues(self) keys(self) pop(self, key, *args) popitem(self) setdefault(self, key, failobj=None) update(self, dict=None, **kwargs) valueForKey = _UserDict_valueForKey(self, key, default=<class MiscUtils.NoDefault at 0x4842f9bc>) values(self) Class methods inherited from UserDict.UserDict: fromkeys(cls, iterable, value=None) from __builtin__.classobj Methods inherited from MiscUtils.NamedValueAccess.NamedValueAccess: handleUnknownSetKey(self, key) hasValueForName(self, keysString) `Check whether name is available.` resetKeyBindings(self) `Rest all key bindings, releasing alreaedy referenced values.` setValueForKey(self, key, value) `Set value for a given key. Suppose key is 'foo'. This method sets the value with the following precedence: 1. Public attributes before private attributes 2. Methods before non-methods More specifically, this method then uses one of the following: @@ 2000-03-04 ce: fill in ... or invokes handleUnknownSetKey().` valueForKeySequence(self, listOfKeys, default=None) `Get the value for the given list of keys.` valueForName(self, keysString, default=None) `Get the value for the given keysString. This is the more advanced version of valueForKey(), which can only handle single names. This method can handle 'foo', 'foo1.foo2', 'a.b.c.d', etc. It will traverse dictionaries if needed.` valueForUnknownKey(self, key, default) valuesForNames(self, keys, default=None, defaults=None, forgive=0, includeNames=0) `Get all values for given names. Returns a list of values that match the given keys, each of which is passed through valueForName() and so could be of the form 'a.b.c'. keys and defaults are sequences. default is any kind of object. forgive and includeNames are flags. If default is not None, then it is substituted when a key is not found. Otherwise, if defaults is not None, then it's corresponding/parallel value for the current key is substituted when a key is not found. Otherwise, if forgive is true, then unknown keys simply don't produce any values. Otherwise, if default and defaults are None, and forgive is false, then the unknown keys will probably raise an exception through valueForUnknownKey() although that method can always return a final, default value. if keys is None, then None is returned. If keys is an empty list, then None is returned. Often these last four arguments are specified by key. Examples: names = ['origin.x', 'origin.y', 'size.width', 'size.height'] obj.valuesForNames(names) obj.valuesForNames(names, default=0.0) obj.valuesForNames(names, defaults=[0.0, 0.0, 100.0, 100.0]) obj.valuesForNames(names, forgive=0) @@ 2000-03-04 ce: includeNames is only supported when forgive=1. It should be supported for the other cases. It should be documented. It should be included in the test cases.`
class SimpleCookie(BaseCookie)
`` | `SimpleCookie 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.`
| Method resolution order: SimpleCookie BaseCookie UserDict.UserDict MiscUtils.NamedValueAccess.NamedValueAccess Methods defined here: value_decode(self, val) value_encode(self, val) Methods inherited from BaseCookie: __init__(self, input=None) __repr__(self) __setitem__(self, key, value) `Dictionary style assignment.` __str__ = output(self, attrs=None, header='Set-Cookie:', sep='\n') `Return a string suitable for HTTP.` js_output(self, attrs=None) `Return a string suitable for JavaScript.` load(self, rawdata) `Load cookies from a string (presumably HTTP_COOKIE) or from a dictionary. Loading cookies from a dictionary 'd' is equivalent to calling: map(Cookie.__setitem__, d.keys(), d.values())` output(self, attrs=None, header='Set-Cookie:', sep='\n') `Return a string suitable for HTTP.` Methods inherited from UserDict.UserDict: __cmp__(self, dict) __contains__(self, key) __delitem__(self, key) __getitem__(self, key) __len__(self) clear(self) copy(self) get(self, key, failobj=None) hasValueForKey = _UserDict_hasValueForKey(self, key) has_key(self, key) items(self) iteritems(self) iterkeys(self) itervalues(self) keys(self) pop(self, key, *args) popitem(self) setdefault(self, key, failobj=None) update(self, dict=None, **kwargs) valueForKey = _UserDict_valueForKey(self, key, default=<class MiscUtils.NoDefault at 0x4842f9bc>) values(self) Class methods inherited from UserDict.UserDict: fromkeys(cls, iterable, value=None) from __builtin__.classobj Methods inherited from MiscUtils.NamedValueAccess.NamedValueAccess: handleUnknownSetKey(self, key) hasValueForName(self, keysString) `Check whether name is available.` resetKeyBindings(self) `Rest all key bindings, releasing alreaedy referenced values.` setValueForKey(self, key, value) `Set value for a given key. Suppose key is 'foo'. This method sets the value with the following precedence: 1. Public attributes before private attributes 2. Methods before non-methods More specifically, this method then uses one of the following: @@ 2000-03-04 ce: fill in ... or invokes handleUnknownSetKey().` valueForKeySequence(self, listOfKeys, default=None) `Get the value for the given list of keys.` valueForName(self, keysString, default=None) `Get the value for the given keysString. This is the more advanced version of valueForKey(), which can only handle single names. This method can handle 'foo', 'foo1.foo2', 'a.b.c.d', etc. It will traverse dictionaries if needed.` valueForUnknownKey(self, key, default) valuesForNames(self, keys, default=None, defaults=None, forgive=0, includeNames=0) `Get all values for given names. Returns a list of values that match the given keys, each of which is passed through valueForName() and so could be of the form 'a.b.c'. keys and defaults are sequences. default is any kind of object. forgive and includeNames are flags. If default is not None, then it is substituted when a key is not found. Otherwise, if defaults is not None, then it's corresponding/parallel value for the current key is substituted when a key is not found. Otherwise, if forgive is true, then unknown keys simply don't produce any values. Otherwise, if default and defaults are None, and forgive is false, then the unknown keys will probably raise an exception through valueForUnknownKey() although that method can always return a final, default value. if keys is None, then None is returned. If keys is an empty list, then None is returned. Often these last four arguments are specified by key. Examples: names = ['origin.x', 'origin.y', 'size.width', 'size.height'] obj.valuesForNames(names) obj.valuesForNames(names, default=0.0) obj.valuesForNames(names, defaults=[0.0, 0.0, 100.0, 100.0]) obj.valuesForNames(names, forgive=0) @@ 2000-03-04 ce: includeNames is only supported when forgive=1. It should be supported for the other cases. It should be documented. It should be included in the test cases.`
class SmartCookie(BaseCookie)
`` | `SmartCookie SmartCookie supports arbitrary objects as cookie values. If the object is a string, then it is quoted. If the object is not a string, however, then SmartCookie will use cPickle to serialize the object into a string representation. Note: Large cookie values add overhead because they must be retransmitted on every HTTP transaction. Note: HTTP has a 2k limit on the size of a cookie. This class does not check for this limit, so be careful!!!`
| Method resolution order: SmartCookie BaseCookie UserDict.UserDict MiscUtils.NamedValueAccess.NamedValueAccess Methods defined here: value_decode(self, val) value_encode(self, val) Methods inherited from BaseCookie: __init__(self, input=None) __repr__(self) __setitem__(self, key, value) `Dictionary style assignment.` __str__ = output(self, attrs=None, header='Set-Cookie:', sep='\n') `Return a string suitable for HTTP.` js_output(self, attrs=None) `Return a string suitable for JavaScript.` load(self, rawdata) `Load cookies from a string (presumably HTTP_COOKIE) or from a dictionary. Loading cookies from a dictionary 'd' is equivalent to calling: map(Cookie.__setitem__, d.keys(), d.values())` output(self, attrs=None, header='Set-Cookie:', sep='\n') `Return a string suitable for HTTP.` Methods inherited from UserDict.UserDict: __cmp__(self, dict) __contains__(self, key) __delitem__(self, key) __getitem__(self, key) __len__(self) clear(self) copy(self) get(self, key, failobj=None) hasValueForKey = _UserDict_hasValueForKey(self, key) has_key(self, key) items(self) iteritems(self) iterkeys(self) itervalues(self) keys(self) pop(self, key, *args) popitem(self) setdefault(self, key, failobj=None) update(self, dict=None, **kwargs) valueForKey = _UserDict_valueForKey(self, key, default=<class MiscUtils.NoDefault at 0x4842f9bc>) values(self) Class methods inherited from UserDict.UserDict: fromkeys(cls, iterable, value=None) from __builtin__.classobj Methods inherited from MiscUtils.NamedValueAccess.NamedValueAccess: handleUnknownSetKey(self, key) hasValueForName(self, keysString) `Check whether name is available.` resetKeyBindings(self) `Rest all key bindings, releasing alreaedy referenced values.` setValueForKey(self, key, value) `Set value for a given key. Suppose key is 'foo'. This method sets the value with the following precedence: 1. Public attributes before private attributes 2. Methods before non-methods More specifically, this method then uses one of the following: @@ 2000-03-04 ce: fill in ... or invokes handleUnknownSetKey().` valueForKeySequence(self, listOfKeys, default=None) `Get the value for the given list of keys.` valueForName(self, keysString, default=None) `Get the value for the given keysString. This is the more advanced version of valueForKey(), which can only handle single names. This method can handle 'foo', 'foo1.foo2', 'a.b.c.d', etc. It will traverse dictionaries if needed.` valueForUnknownKey(self, key, default) valuesForNames(self, keys, default=None, defaults=None, forgive=0, includeNames=0) `Get all values for given names. Returns a list of values that match the given keys, each of which is passed through valueForName() and so could be of the form 'a.b.c'. keys and defaults are sequences. default is any kind of object. forgive and includeNames are flags. If default is not None, then it is substituted when a key is not found. Otherwise, if defaults is not None, then it's corresponding/parallel value for the current key is substituted when a key is not found. Otherwise, if forgive is true, then unknown keys simply don't produce any values. Otherwise, if default and defaults are None, and forgive is false, then the unknown keys will probably raise an exception through valueForUnknownKey() although that method can always return a final, default value. if keys is None, then None is returned. If keys is an empty list, then None is returned. Often these last four arguments are specified by key. Examples: names = ['origin.x', 'origin.y', 'size.width', 'size.height'] obj.valuesForNames(names) obj.valuesForNames(names, default=0.0) obj.valuesForNames(names, defaults=[0.0, 0.0, 100.0, 100.0]) obj.valuesForNames(names, forgive=0) @@ 2000-03-04 ce: includeNames is only supported when forgive=1. It should be supported for the other cases. It should be documented. It should be included in the test cases.`

Data
`` |  | __all__ = ['CookieError', 'BaseCookie', 'SimpleCookie', 'SerialCookie', 'SmartCookie', 'Cookie']