Monday, December 27, 2010

can't pickle Input objects -- error in django 1.3 beta 1 with memcached cache backend

Hi,

With django 1.3 alpha 1, I was using the following piece of code in my
urls.py without a problem:

cache_page(views.IndexView.as_view(), timeout)


When upgrading to 1.3 beta 1, I got this error:

Environment:


Request Method: GET
Request URL: http://localhost:8000/bg/

Django Version: 1.3 beta 1
Python Version: 2.6.6
Installed Applications:
['localeurl',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.admin',
'registration',
'main']
Installed Middleware:
('localeurl.middleware.LocaleURLMiddleware',
'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 "/usr/local/lib/python2.6/dist-packages/django/core/handlers/
base.py" in get_response
111. response = callback(request,
*callback_args, **callback_kwargs)
File "/usr/local/lib/python2.6/dist-packages/django/utils/
decorators.py" in _wrapped_view
101. result =
middleware.process_response(request, response)
File "/usr/local/lib/python2.6/dist-packages/django/middleware/
cache.py" in process_response
89. self.cache.set(cache_key, response, timeout)
File "/usr/local/lib/python2.6/dist-packages/django/core/cache/
backends/memcached.py" in set
64. self._cache.set(key, value,
self._get_memcache_timeout(timeout))
File "/usr/local/lib/python2.6/dist-packages/memcache.py" in set
525. return self._set("set", key, val, time,
min_compress_len)
File "/usr/local/lib/python2.6/dist-packages/memcache.py" in _set
739. store_info = self._val_to_store_info(val,
min_compress_len)
File "/usr/local/lib/python2.6/dist-packages/memcache.py" in
_val_to_store_info
711. pickler.dump(val)
File "/usr/lib/python2.6/copy_reg.py" in _reduce_ex
70. raise TypeError, "can't pickle %s objects" %
base.__name__

Exception Type: TypeError at /
Exception Value: can't pickle Input objects

With the val in question being this:

<django.template.response.TemplateResponse object at 0x7f2c49989690>

Can someone guide me into fixing the invocation, or should I file a
bug against beta 1?

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment