Re: [Django] #7836: django.test.client._session should check for session middleware instead

12 views
Skip to first unread message

Django

unread,
Jun 12, 2011, 12:33:41 PM6/12/11
to django-...@googlegroups.com
#7836: django.test.client._session should check for session middleware instead
------------------------------------+---------------------------------
Reporter: trevor | Owner: nobody
Type: Bug | Status: closed
Milestone: | Component: Testing framework
Version: SVN | Severity: Normal
Resolution: fixed | Keywords:
Triage Stage: Accepted | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 |
------------------------------------+---------------------------------
Changes (by ramiro):

* 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.

Django

unread,
Mar 14, 2012, 10:46:09 PM3/14/12
to django-...@googlegroups.com
#7836: django.test.client._session should check for session middleware instead
---------------------------------+------------------------------------
Reporter: trevor | Owner: nobody
Type: Bug | Status: closed
Component: Testing framework | Version: SVN
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
---------------------------------+------------------------------------

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>

Django

unread,
Mar 14, 2012, 10:46:56 PM3/14/12
to django-...@googlegroups.com
#7836: django.test.client._session should check for session middleware instead
-----------------------------------+------------------------------------
Reporter: trevor | Owner: nobody
Type: Bug | Status: reopened
Component: Testing framework | Version: SVN
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------------+------------------------------------
Changes (by ramiro):

* status: closed => reopened
* ui_ux: => 0
* resolution: fixed =>
* easy: => 0


--
Ticket URL: <https://code.djangoproject.com/ticket/7836#comment:7>

Django

unread,
Jun 4, 2012, 5:53:24 PM6/4/12
to django-...@googlegroups.com
#7836: django.test.client._session should check for session middleware instead
-----------------------------------+------------------------------------
Reporter: trevor | Owner: nobody
Type: Bug | Status: reopened
Component: Testing framework | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------------+------------------------------------
Changes (by charettes):

* cc: charette.s@… (added)


--
Ticket URL: <https://code.djangoproject.com/ticket/7836#comment:8>

Django

unread,
Mar 8, 2013, 4:14:40 AM3/8/13
to django-...@googlegroups.com
#7836: django.test.client._session should check for session middleware instead
-----------------------------------+------------------------------------
Reporter: trevor | Owner: nobody
Type: Bug | Status: reopened
Component: Testing framework | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------------+------------------------------------
Changes (by vzima):

* cc: vlastimil@… (added)


--
Ticket URL: <https://code.djangoproject.com/ticket/7836#comment:9>

Django

unread,
Oct 16, 2013, 9:12:07 AM10/16/13
to django-...@googlegroups.com
#7836: django.test.client._session should check for session middleware instead
-----------------------------------+------------------------------------
Reporter: trevor | Owner: nobody
Type: Bug | Status: new

Component: Testing framework | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------------+------------------------------------

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>

Django

unread,
Oct 16, 2013, 9:32:06 AM10/16/13
to django-...@googlegroups.com
#7836: django.test.client._session should check for session middleware instead
-----------------------------------+------------------------------------
Reporter: trevor | Owner: nobody
Type: Bug | Status: new
Component: Testing framework | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------------+------------------------------------
Changes (by unaizalakain):

* cc: unai@… (added)


--
Ticket URL: <https://code.djangoproject.com/ticket/7836#comment:12>

Django

unread,
Oct 16, 2013, 9:37:45 AM10/16/13
to django-...@googlegroups.com
#7836: django.test.client._session should check for session middleware instead
-----------------------------------+------------------------------------
Reporter: trevor | Owner: nobody
Type: Bug | Status: new
Component: Testing framework | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------------+------------------------------------

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>

Django

unread,
Oct 16, 2013, 9:53:28 AM10/16/13
to django-...@googlegroups.com
#7836: django.test.client._session should check for session middleware instead
-----------------------------------+------------------------------------
Reporter: trevor | Owner: nobody
Type: Bug | Status: new
Component: Testing framework | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------------+------------------------------------

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>

Django

unread,
Apr 8, 2016, 12:10:13 PM4/8/16
to django-...@googlegroups.com
#7836: django.test.client._session should check for session middleware instead
-----------------------------------+------------------------------------
Reporter: trevor | Owner: nobody
Type: Bug | Status: closed

Component: Testing framework | Version: master
Severity: Normal | Resolution: fixed

Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------------+------------------------------------
Changes (by claudep):

* 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>

Reply all
Reply to author
Forward
0 new messages