* status: new => closed
* resolution: => fixed
Comment:
In [16386]:
{{{
#!CommitTicketReference repository="" revision="16386"
Fixed #7836 -- Modified strategy used by the test client to check for
session functionality so it is useful in environments where the DB-based
session backend isn't being used. Thanks trevor for the report.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/7836#comment:5>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
Comment (by ramiro):
In [17739]:
{{{
#!CommitTicketReference repository="" revision="17739"
Reverted r16386 because it replaced a brittle method with another not less
arbitrary method when the test client checks for the presence of the
bundled
session backends+session middleware combination.
We will revisit the issue soon, probably to make these checks even less
strict.
Refs #7836, #16605
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/7836#comment:6>
* status: closed => reopened
* ui_ux: => 0
* resolution: fixed =>
* easy: => 0
--
Ticket URL: <https://code.djangoproject.com/ticket/7836#comment:7>
* cc: charette.s@… (added)
--
Ticket URL: <https://code.djangoproject.com/ticket/7836#comment:8>
* cc: vlastimil@… (added)
--
Ticket URL: <https://code.djangoproject.com/ticket/7836#comment:9>
Comment (by unaizalakain):
I'm probably missing something, where's the need of checking if some kind
of session middleware exists? If not present, wouldn't ``{}`` be returned
anyways?
BTW, shouldn't it be better if the engine module import happen outside
``_session`` and instead of checking for ``if coockie`` ``if cookie is not
None`` is checked?
--
Ticket URL: <https://code.djangoproject.com/ticket/7836#comment:11>
* cc: unai@… (added)
--
Ticket URL: <https://code.djangoproject.com/ticket/7836#comment:12>
Comment (by vzima):
Replying to [comment:11 unaizalakain]:
> I'm probably missing something, where's the need of checking if some
kind of session middleware exists? If not present, wouldn't `{}` be
returned anyways?
In application, the attribute `request.session` is created by
`SessionMiddleware`. If missing you will get `AttributeError`.
In tests, you get either empty dictionary or `SessionStore`.
The problem here is no error is indicated by client when you don't have
sessions installed, but `client.login` does not do a valid login. This is
problem which is not quite easy to find.
>
> BTW, shouldn't it be better if the engine module import happen outside
`_session` and instead of checking for `if coockie` `if cookie is not
None` is checked?
It wouldn't. You can change settings for the test and you want the test to
use yours.
--
Ticket URL: <https://code.djangoproject.com/ticket/7836#comment:13>
Comment (by unaizalakain):
What if `_sesion` arises an exception if no subclass of the session
middleware is found?
--
Ticket URL: <https://code.djangoproject.com/ticket/7836#comment:14>
* status: new => closed
* resolution: => fixed
Comment:
I think that the recent commit 21dd98a3 fixing #25699 is also fixing this
issue.
--
Ticket URL: <https://code.djangoproject.com/ticket/7836#comment:15>