This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author mixedpuppy
Recipients mixedpuppy, rhymes, trentm
Date 2008-11-08.00:44:34
SpamBayes Score 3.5011752e-07
Marked as misclassified No
Message-id <1226105075.83.0.521667156298.issue3073@psf.upfronthosting.co.za>
In-reply-to
Content
The problem is that spaces are not allowed in the attribute values. 
Here is a work around

# hack fix of Cookie.BasicCookie
import Cookie
import re
_LegalCharsPatt  = r"\w\d!#%&'~_`><@,:/\$\*\+\-\.\^\|\)\(\?\}\{\="
_FixedCookiePattern = re.compile(
    r"(?x)"                       # This is a Verbose pattern
    r"(?P<key>"                   # Start of group 'key'
    "["+ _LegalCharsPatt +"]+?"     # Any word of at least one letter,
nongreedy
    r")"                          # End of group 'key'
    r"\s*=\s*"                    # Equal Sign
    r"(?P<val>"                   # Start of group 'val'
    r'"(?:[^\\"]|\\.)*"'            # Any doublequoted string
    r"|"                            # or
    "["+ _LegalCharsPatt +"\ ]*"        # Any word or empty string
    r")"                          # End of group 'val'
    r"\s*;?"                      # Probably ending in a semi-colon
    )

class FixedCookie(Cookie.SimpleCookie):
    def load(self, rawdata):
        """Load cookies from a string (presumably HTTP_COOKIE) or
        from a dictionary.  Loading cookies from a dictionary 'd'
        is equivalent to calling:
            map(Cookie.__setitem__, d.keys(), d.values())
        """
        if type(rawdata) == type(""):
            self._BaseCookie__ParseString(rawdata, _FixedCookiePattern)
        else:
            self.update(rawdata)
        return
History
Date User Action Args
2008-11-08 00:44:35mixedpuppysetrecipients: + mixedpuppy, rhymes, trentm
2008-11-08 00:44:35mixedpuppysetmessageid: <1226105075.83.0.521667156298.issue3073@psf.upfronthosting.co.za>
2008-11-08 00:44:34mixedpuppylinkissue3073 messages
2008-11-08 00:44:34mixedpuppycreate