Opened 12 years ago
Last modified 12 years ago
#18674 closed Bug
Session app triggers an AttributeError — at Initial Version
Reported by: | Owned by: | nobody | |
---|---|---|---|
Component: | contrib.sessions | Version: | 1.4 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
I suspect this occurs when session has expired, or something similar and may be related to a change of API in django 1.4:
AttributeError at /
'QuerySet' object has no attribute '_prefetch_related_lookups'
Environment:
Request Method: GET
Django Version: 1.4
Python Version: 2.7.3
Installed Applications:
('django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
'xxx'
'django.contrib.admin')
Installed Middleware:
('django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware')
Traceback:
File "xxx/Django/django/core/handlers/base.py" in get_response
- response = middleware_method(request, response)
File "xxx/Django/django/contrib/sessions/middleware.py" in process_response
- request.session.save()
File "xxx/Django/django/contrib/sessions/backends/db.py" in save
- session_data=self.encode(self._get_session(no_load=must_create)),
File "xxx/Django/django/contrib/sessions/backends/base.py" in encode
- pickled = pickle.dumps(session_dict, pickle.HIGHEST_PROTOCOL)
File "xxx/Django/django/db/models/query.py" in getstate
- len(self)
File "xxx/Django/django/db/models/query.py" in len
- if self._prefetch_related_lookups and not self._prefetch_done:
Exception Type: AttributeError at /
Exception Value: 'QuerySet' object has no attribute '_prefetch_related_lookups'
DB is MySQL.