Opened 15 years ago

Closed 15 years ago

#10210 closed (duplicate)

utils/cache.py _generate_cache_key expects headers to be string

Reported by: daaku Owned by: nobody
Component: Core (Cache system) Version: dev
Severity: 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'm using trunk@9817. Tests are failing in the auth module when the cache framework is enabled. This was with a new project, where I enabled admin (for getting templates for auth tests) and the cache middleware.

Creating test database...
Creating table django_admin_log
Creating table auth_permission
Creating table auth_group
Creating table auth_user
Creating table auth_message
Creating table django_content_type
Creating table django_session
Creating table django_site
Installing index for admin.LogEntry model
Installing index for auth.Permission model
Installing index for auth.Message model
...E.E.E.E......
======================================================================
ERROR: test_confirm_complete (django.contrib.auth.tests.views.PasswordResetTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/nshah/Development/arch-dev01/www/daaku/lib/django/contrib/auth/tests/views.py", line 81, in test_confirm_complete
    response = self.client.get(path)
  File "/Users/nshah/Development/arch-dev01/www/daaku/lib/django/test/client.py", line 277, in get
    return self.request(**r)
  File "/Users/nshah/Development/arch-dev01/www/daaku/lib/django/test/client.py", line 221, in request
    response = self.handler(environ)
  File "/Users/nshah/Development/arch-dev01/www/daaku/lib/django/test/client.py", line 70, in __call__
    response = middleware_method(request, response)
  File "/Users/nshah/Development/arch-dev01/www/daaku/lib/django/middleware/cache.py", line 93, in process_response
    cache_key = learn_cache_key(request, response, timeout, self.key_prefix)
  File "/data/www/daaku/lib/django/utils/cache.py", line 192, in learn_cache_key
    return _generate_cache_key(request, headerlist, key_prefix)
  File "/data/www/daaku/lib/django/utils/cache.py", line 145, in _generate_cache_key
    ctx.update(value)
TypeError: update() argument 1 must be string or read-only buffer, not SimpleCookie

======================================================================
ERROR: test_confirm_invalid (django.contrib.auth.tests.views.PasswordResetTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/nshah/Development/arch-dev01/www/daaku/lib/django/contrib/auth/tests/views.py", line 54, in test_confirm_invalid
    response = self.client.get(path)
  File "/Users/nshah/Development/arch-dev01/www/daaku/lib/django/test/client.py", line 277, in get
    return self.request(**r)
  File "/Users/nshah/Development/arch-dev01/www/daaku/lib/django/test/client.py", line 221, in request
    response = self.handler(environ)
  File "/Users/nshah/Development/arch-dev01/www/daaku/lib/django/test/client.py", line 70, in __call__
    response = middleware_method(request, response)
  File "/Users/nshah/Development/arch-dev01/www/daaku/lib/django/middleware/cache.py", line 93, in process_response
    cache_key = learn_cache_key(request, response, timeout, self.key_prefix)
  File "/data/www/daaku/lib/django/utils/cache.py", line 192, in learn_cache_key
    return _generate_cache_key(request, headerlist, key_prefix)
  File "/data/www/daaku/lib/django/utils/cache.py", line 145, in _generate_cache_key
    ctx.update(value)
TypeError: update() argument 1 must be string or read-only buffer, not SimpleCookie

======================================================================
ERROR: test_confirm_valid (django.contrib.auth.tests.views.PasswordResetTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/nshah/Development/arch-dev01/www/daaku/lib/django/contrib/auth/tests/views.py", line 43, in test_confirm_valid
    response = self.client.get(path)
  File "/Users/nshah/Development/arch-dev01/www/daaku/lib/django/test/client.py", line 277, in get
    return self.request(**r)
  File "/Users/nshah/Development/arch-dev01/www/daaku/lib/django/test/client.py", line 221, in request
    response = self.handler(environ)
  File "/Users/nshah/Development/arch-dev01/www/daaku/lib/django/test/client.py", line 66, in __call__
    response = self.get_response(request)
  File "/Users/nshah/Development/arch-dev01/www/daaku/lib/django/core/handlers/base.py", line 67, in get_response
    response = middleware_method(request)
  File "/Users/nshah/Development/arch-dev01/www/daaku/lib/django/middleware/cache.py", line 126, in process_request
    cache_key = get_cache_key(request, self.key_prefix)
  File "/data/www/daaku/lib/django/utils/cache.py", line 165, in get_cache_key
    return _generate_cache_key(request, headerlist, key_prefix)
  File "/data/www/daaku/lib/django/utils/cache.py", line 145, in _generate_cache_key
    ctx.update(value)
TypeError: update() argument 1 must be string or read-only buffer, not SimpleCookie

======================================================================
ERROR: Error is raised if the provided email address isn't currently registered
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/nshah/Development/arch-dev01/www/daaku/lib/django/contrib/auth/tests/views.py", line 16, in test_email_not_found
    response = self.client.get('/password_reset/')
  File "/Users/nshah/Development/arch-dev01/www/daaku/lib/django/test/client.py", line 277, in get
    return self.request(**r)
  File "/Users/nshah/Development/arch-dev01/www/daaku/lib/django/test/client.py", line 221, in request
    response = self.handler(environ)
  File "/Users/nshah/Development/arch-dev01/www/daaku/lib/django/test/client.py", line 70, in __call__
    response = middleware_method(request, response)
  File "/Users/nshah/Development/arch-dev01/www/daaku/lib/django/middleware/cache.py", line 93, in process_response
    cache_key = learn_cache_key(request, response, timeout, self.key_prefix)
  File "/data/www/daaku/lib/django/utils/cache.py", line 192, in learn_cache_key
    return _generate_cache_key(request, headerlist, key_prefix)
  File "/data/www/daaku/lib/django/utils/cache.py", line 145, in _generate_cache_key
    ctx.update(value)
TypeError: update() argument 1 must be string or read-only buffer, not SimpleCookie

----------------------------------------------------------------------
Ran 16 tests in 0.443s

FAILED (errors=4)
Destroying test database...

Change History (2)

comment:1 by Rob Hudson <treborhudson@…>, 15 years ago

Component: UncategorizedCache system

comment:2 by Timothée Peignier, 15 years ago

Resolution: duplicate
Status: newclosed

Duplicate of #5176

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