Django test client cookie handling broken with Python trunk and next 2.6.$NEXT
|Reported by:||James Henstridge||Owned by:||nobody|
|Has patch:||yes||Needs documentation:|
|Needs tests:||Patch needs improvement:|
After upgrading to the the Ubuntu 10.04 alpha, I found that the tests for my Django application started failing. This seemed to be because the Python 2.6 package included unreleased fixes from the release26-maint branch. In particular it included the following bug fix to the Cookie module:
When the django.test client builds up a WSGI environment, it passes a SimpleCookie instance for HTTP_COOKIE. Prior to the change, django.http.parse_cookie() would copy the morsels directly. After the change, the values for all the cookies are the str() version of the morsels (e.g. "Set-Cookie: sessionid=value" instead of "value").
This breaks any tests that depend on cookie handling (e.g. those that depend on cookie authentication).
While this does represent a change of behaviour in Python, the behaviour of the django test client does not really match the WSGI specification in this regard, so I think it'd be worth fixing in Django. Patch attached.