#11475: test.Client.session.save() raises error for anonymous users
----------------------------------------+-----------------------------------
Reporter: [email protected] | Owner: nobody
Status: new | Milestone:
Component: Testing framework | Version: 1.1-beta-1
Resolution: | Keywords:
Stage: Unreviewed | Has_patch: 0
Needs_docs: 0 | Needs_tests: 0
Needs_better_patch: 0 |
----------------------------------------+-----------------------------------
Comment (by [email protected]):
I'm just now running into the same thing. The simple fix, of just having
`Client._session` return `engine.SessionStore(None)` in the case where the
cookie isn't set, generates a new session (with a new session ID) every
time you refer to `self.client.session`, so we probably need to make
`session` a lazy attribute if we want `Client` to be useful for testing
storage of data for anonymous sessions; but I think also we have to
somehow get the cookie set properly; there's code to do that down in the
middle of `Client.login` which could be factored out, and of course that's
already very much duplicative with `SessionMiddleware.process_response`,
which is the code path that normally runs to set the browser cookie for
the session; so we could factor that out from two places and use it in a
third. (But I guess it doesn't run in `Client.get`. Does `Client.get`
bypass middleware?)
I don't know my way around the code very well, so it's possible that the
anonymous user above and I are doing something dumb.
--
Ticket URL: <http://code.djangoproject.com/ticket/11475#comment:2>
Django <http://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---