Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#17321 closed Bug (worksforme)

Errors when running messages test with USE_ETAGS = True

Reported by: Etienne Desautels Owned by: nobody
Component: contrib.messages Version: 1.3
Severity: Normal Keywords: etag message
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


When running the test suite on a barebones Django 1.3.1 install but with USE_ETAGS set to True, there's 4 errors (mostly all identical) coming from the contrib.messages test suite. Here's one:

ERROR: test_with_template_response (django.contrib.messages.tests.cookie.CookieTest)
Traceback (most recent call last):
  File "/Users/me/.virtualenvs/test/lib/python2.6/site-packages/django/contrib/messages/tests/", line 195, in test_with_template_response
    response =, data, follow=True)
  File "/Users/me/.virtualenvs/test/lib/python2.6/site-packages/django/test/", line 451, in post
    response = self._handle_redirects(response, **extra)
  File "/Users/me/.virtualenvs/test/lib/python2.6/site-packages/django/test/", line 561, in _handle_redirects
    response = self.get(path, QueryDict(query), follow=False, **extra)
  File "/Users/me/.virtualenvs/test/lib/python2.6/site-packages/django/test/", line 439, in get
    response = super(Client, self).get(path, data=data, **extra)
  File "/Users/me/.virtualenvs/test/lib/python2.6/site-packages/django/test/", line 241, in get
    return self.request(**r)
  File "/Users/me/.virtualenvs/test/lib/python2.6/site-packages/django/core/handlers/", line 111, in get_response
    response = callback(request, *callback_args, **callback_kwargs)
  File "/Users/me/.virtualenvs/test/lib/python2.6/site-packages/django/views/decorators/", line 80, in _wrapped_view_func
  File "/Users/me/.virtualenvs/test/lib/python2.6/site-packages/django/utils/", line 122, in add_never_cache_headers
    patch_response_headers(response, cache_timeout=-1)
  File "/Users/me/.virtualenvs/test/lib/python2.6/site-packages/django/utils/", line 111, in patch_response_headers
    response['ETag'] = '"%s"' % md5_constructor(response.content).hexdigest()
  File "/Users/me/.virtualenvs/test/lib/python2.6/site-packages/django/template/", line 113, in _get_content
    raise ContentNotRenderedError('The response content must be rendered before it can be accessed.')
ContentNotRenderedError: The response content must be rendered before it can be accessed.

They are all in "test_with_template_response".

Change History (2)

comment:1 Changed 5 years ago by Aymeric Augustin

Needs documentation: unset
Needs tests: unset
Patch needs improvement: unset
Resolution: worksforme
Status: newclosed
Type: UncategorizedBug

I could reproduce this on 1.3, but not on trunk, so it must have been fixed in the meantime.

comment:2 Changed 5 years ago by slacy@…

I'm seeing this as well in 1.3.1 Is there any simple workaround?

Note: See TracTickets for help on using tickets.
Back to Top