diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2015-03-18 16:03:40 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2015-03-18 16:03:40 (GMT) |
commit | 6c32585f677b71eb1206852d24f077f602780c85 (patch) | |
tree | 3204be9816cea9229172587a5c81dc4041a82d92 /Lib/http | |
parent | cb7e5f6f087057570682c961666fb60dae688bc5 (diff) | |
download | cpython-6c32585f677b71eb1206852d24f077f602780c85.zip cpython-6c32585f677b71eb1206852d24f077f602780c85.tar.gz cpython-6c32585f677b71eb1206852d24f077f602780c85.tar.bz2 |
Restored backward compatibility of pickling http.cookies.Morsel. It was
broken after converting instance attributes to properies in issue #2211.
Diffstat (limited to 'Lib/http')
-rw-r--r-- | Lib/http/cookies.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/Lib/http/cookies.py b/Lib/http/cookies.py index f4e9035..98489fb 100644 --- a/Lib/http/cookies.py +++ b/Lib/http/cookies.py @@ -377,6 +377,18 @@ class Morsel(dict): self._value = val self._coded_value = coded_val + def __getstate__(self): + return { + 'key': self._key, + 'value': self._value, + 'coded_value': self._coded_value, + } + + def __setstate__(self, state): + self._key = state['key'] + self._value = state['value'] + self._coded_value = state['coded_value'] + def output(self, attrs=None, header="Set-Cookie:"): return "%s %s" % (header, self.OutputString(attrs)) |