Seems like this really needs a strict and a lax mode. Perhaps a BrowserCookie class that implements the relaxed rules?
That would make this a feature request, though, and so nothing would happen until 3.3, which would be unfortunate.
It is certainly possible to create a more relaxed version for your own use. It seems to me that (untested):
class BrowserCookie(BaseCookie):
def set(self, key, val, coded_val, LegalChars=_LegalChars+':'):
super().set(key, val, coded_val, LegalChars)
would do most of what And Clover wants (not adding or stripping quotes or doing backslash quoting or encoding, accepting : in key names (and more characters could be added; the regex in the parsing step is fairly liberal)).
Making further relaxations is difficult without poking in to module internals, though. |