diff options
Diffstat (limited to 'Lib/http')
-rw-r--r-- | Lib/http/cookies.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/Lib/http/cookies.py b/Lib/http/cookies.py index 556d101..a6de6d5 100644 --- a/Lib/http/cookies.py +++ b/Lib/http/cookies.py @@ -486,8 +486,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.""" |