Create an extension to the Python Cookie module to help solve issues with cookie key/value errors.
By subclassing the SimpleCookie? module you can add support into it to try/except on the set method so invalid cookies get thrown away, but valid cookies are not lost.
File "/home/curseweb/cursedjango/django/django/utils/defensive.py", line 65, in inner_email_exceptions
return func(*args, **kwargs)
File "/home/curseweb/cursedjango/cursesite/middleware/cookies.py", line 13, in process_request
for k, v in request.COOKIES.iteritems():
File "/home/curseweb/cursedjango/django/django/core/handlers/modpython.py", line 83, in _get_cookies
self._cookies = http.parse_cookie(self._req.headers_in.get('cookie', ''))
File "/home/curseweb/cursedjango/django/django/http/__init__.py", line 160, in parse_cookie
c.load(cookie)
File "/usr/local/lib/python2.4/Cookie.py", line 621, in load
self.__ParseString(rawdata)
File "/usr/local/lib/python2.4/Cookie.py", line 652, in __ParseString
self.__set(K, rval, cval)
File "/usr/local/lib/python2.4/Cookie.py", line 574, in __set
M.set(key, real_value, coded_value)
File "/usr/local/lib/python2.4/Cookie.py", line 453, in set
raise CookieError("Illegal key value: %s" % key)
CookieError: Illegal key value: ??est