mirror of
https://github.com/python/cpython.git
synced 2025-11-01 18:51:43 +00:00
Restored backward compatibility of pickling http.cookies.Morsel. It was
broken after converting instance attributes to properies in issue #2211.
This commit is contained in:
parent
cb7e5f6f08
commit
6c32585f67
2 changed files with 32 additions and 0 deletions
|
|
@ -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))
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue