Whilst setting up a new machine for development I took down the latest
development version of Django (7825). I am now experiencing a Pickle
error when running my existing application which has been working fine
on our production servers for a few months. The error occurs when
using the Cache.set function and passing a queryset for the purposes
of caching. It also does the same in anaother view where we're passing
a queryset into the Cache.set

I've checked the backward compatibility changes and cannot see
anything that would directly relate to it. I note that there was a fix
implented at 7773 - http://code.djangoproject.com/ticket/7506, but I'm
not sure if it is relevant.

Has anyone encountered this recently, or can anyone shed some light on
it and suggest a work round, or does it need a ticket?

The code that causes this in the view is:

        
comp=Compfile.objects.filter(campaign=campaign).select_related().order_by("rank")
            for i in comp:
                my_id=i.competition.id
                strapline=i.competition.strapline
                setattr(i,"my_id",my_id)
                setattr(i,"strapline",strapline)
            data={'comp':comp}
            cache.set(cache_name,data,cache_time)

 Traceback from the error is as follows:

Environment:

Request Method: GET
Request URL: http://localhost/hive/competitions_ver2/
Django Version: 0.97-pre-SVN-7825
Python Version: 2.5.2
Installed Applications:
['django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.sites',
 'django.contrib.admin',
 'django.contrib.humanize',
 'hive.promotions',
 'voting']
Installed Middleware:
('django.middleware.common.CommonMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.middleware.doc.XViewMiddleware')


Traceback:
File "C:\Python25\Lib\site-packages\django-trunk\django\core\handlers
\base.py" in get_response
  82.                 response = callback(request, *callback_args,
**callback_kwargs)
File "C:/DATA/PROJECTS/hive\promotions\views.py" in
display_competitions_ver2
  6712.             cache.set(cache_name,data,cache_time)
File "C:\Python25\Lib\site-packages\django-trunk\django\core\cache
\backends\db.py" in set
  41.         return self._base_set('set', key, value, timeout)
File "C:\Python25\Lib\site-packages\django-trunk\django\core\cache
\backends\db.py" in _base_set
  56.         encoded = base64.encodestring(pickle.dumps(value,
2)).strip()

Exception Type: PicklingError at /hive/competitions_ver2/
Exception Value: Can't pickle <type 'function'>: attribute lookup
__builtin__.function failed

--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to