tickets: 7836
This data as json
id | created | changetime | last_pulled_from_trac | stage | status | component | type | severity | version | resolution | summary | description | owner | reporter | keywords | easy | has_patch | needs_better_patch | needs_tests | needs_docs | ui_ux |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
7836 | 2008-07-19 15:02:20 | 2016-04-08 16:08:53 | 2022-03-06 03:40:41.095429 | Accepted | closed | Testing framework | Bug | Normal | dev | fixed | django.test.client._session should check for session middleware instead | The django test client class allows you to use `self.client.session` only if you have `'django.contrib.sessions'` in your `INSTALLED_APPS` setting. That is, it assumes you are using sessions if and only if you have the sessions app installed. This assumption breaks down when you are using the sessions middleware independently of the sessions app, for instance if you are using a cache backend for sessions. I propose that `django.test.client._session` check for the sessions middleware class in `MIDDLEWARE_CLASSES` instead of the sessions app in `INSTALLED_APPS` to make it easier for people using the session middleware independently of the sessions app to use `self.client.sesssion` in tests. | nobody | trevor | 0 | 0 | 0 | 0 | 0 | 0 |