[issue3924] cookielib chokes on non-integer cookie version, should ignore it instead

Henrik Olsson report at bugs.python.org
Mon Mar 2 13:11:41 CET 2009


Henrik Olsson <henriko at wip.se> added the comment:

The cookiejar workaround in the first comment did not work for me. The
cookies didn't stick in it. I guess version needs to be set.. this
worked for me:

class ForgivingCookieJar(cookielib.CookieJar):
    def _cookie_from_cookie_tuple(self, tup, request):
        name, value, standard, rest = tup
        version = standard.get("version", None)
        if version is not None:
            # Some servers add " around the version number, this module
expects a pure int.
            standard["version"] = version.strip('"')
        return cookielib.CookieJar._cookie_from_cookie_tuple(self, tup,
request)

----------
nosy: +henriko

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue3924>
_______________________________________


More information about the Python-bugs-list mailing list