diff options
Diffstat (limited to 'Lib/http/cookies.py')
-rw-r--r-- | Lib/http/cookies.py | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/Lib/http/cookies.py b/Lib/http/cookies.py index 00082a6..482e601 100644 --- a/Lib/http/cookies.py +++ b/Lib/http/cookies.py @@ -330,8 +330,8 @@ class Morsel(dict): "comment" : "Comment", "domain" : "Domain", "max-age" : "Max-Age", - "secure" : "secure", - "httponly" : "httponly", + "secure" : "Secure", + "httponly" : "HttpOnly", "version" : "Version", } @@ -487,8 +487,12 @@ class BaseCookie(dict): def __setitem__(self, key, value): """Dictionary style assignment.""" - rval, cval = self.value_encode(value) - self.__set(key, rval, cval) + if isinstance(value, Morsel): + # allow assignment of constructed Morsels (e.g. for pickling) + dict.__setitem__(self, key, value) + else: + rval, cval = self.value_encode(value) + self.__set(key, rval, cval) def output(self, attrs=None, header="Set-Cookie:", sep="\015\012"): """Return a string suitable for HTTP.""" |