[New-bugs-announce] [issue2211] Cookie.Morsel interface needs update

Jamie Bliss report at bugs.python.org
Fri Feb 29 21:00:59 CET 2008

New submission from Jamie Bliss:

Cookie.Morsel lacks in properly overloading dict methods, amongst other
* .__eq__() does not take .key and .value into account
* .copy() returns a dict, not a Morsel
* .update() allows invalid attributes in, eg
Morsel().update({'eggs':'spam'}) works but Morsel()['eggs'] = 'spam' fails
* .__len__() includes unset keys (why does it set them to an empty string?)
* .__repr__() doesn't print out attributes (path, comment, etc)
* Handling of unicode is fuzzy at best: try Morsel().set(u'eggs\u00bf',
u'\u00f1', u'\00f1'.encode('utf-8'))
* Specifying the idmap and translate function in .set() seems wrong
* Setting .key doesn't check against invalid keys (eg, reserved names)
* The entire Morsel class is undocumented
* There is no way to automatically sync .value and .coded_value

components: Library (Lib)
messages: 63144
nosy: astronouth7303
severity: normal
status: open
title: Cookie.Morsel interface needs update
type: behavior
versions: Python 2.5, Python 2.6

Tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list