Opened 13 years ago

Closed 13 years ago

Last modified 13 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

Description

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/base.py", line 195, in test_with_template_response
    response = self.client.post(add_url, data, follow=True)
  File "/Users/me/.virtualenvs/test/lib/python2.6/site-packages/django/test/client.py", line 451, in post
    response = self._handle_redirects(response, **extra)
  File "/Users/me/.virtualenvs/test/lib/python2.6/site-packages/django/test/client.py", 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/client.py", 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/client.py", line 241, in get
    return self.request(**r)
  File "/Users/me/.virtualenvs/test/lib/python2.6/site-packages/django/core/handlers/base.py", 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/cache.py", line 80, in _wrapped_view_func
    add_never_cache_headers(response)
  File "/Users/me/.virtualenvs/test/lib/python2.6/site-packages/django/utils/cache.py", 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/cache.py", 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/response.py", 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 by Aymeric Augustin, 13 years ago

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 by slacy@…, 13 years ago

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