Thanks a LOT !! Frank Further to your analysis I checked the following http://docs.djangoproject.com/en/dev/topics/serialization/#serializing-dataand understood from the note (rather my understanding ) that only .all() query set method would give the serialized data
if we want .filter () ( or any other queryset methods didn`t check them all
) we have to serialize/de-serialize the queryset
Did the following and it worked
from django.core import serializers
cache.set('test1',serializers.serialize("json",User.objects.filter(is_staff=False)[0:10]))
there on I deserialize again to get the objects back
Thanks again !!
Regards
Subramanyam
On Wed, Jan 6, 2010 at 8:42 AM, Frank DiRocco <[email protected]> wrote:
> 'yam,
>
> I have not seen this error, but my responses to the error are inline.
>
>
> On Jan 6, 2010, at 6:30 AM, Subramanyam wrote:
>
> File "/home/bvemu/lib/python2.6/site-packages/django/core/cache/
>> backends/memcached.py", line 37, in set
>> self._cache.set(smart_str(key), value, timeout or
>> self.default_timeout)
>>
>
> So it appears your issue originates when you call cache.set(key,user_list)
>
>
> File "/home/bvemu/lib/python2.6/site-packages/python_memcached-1.45-
>> py2.6.egg/memcache.py", line 515, in set
>> return self._set("set", key, val, time, min_compress_len)
>> File "/home/bvemu/lib/python2.6/site-packages/python_memcached-1.45-
>> py2.6.egg/memcache.py", line 725, in _set
>> store_info = self._val_to_store_info(val, min_compress_len)
>> File "/home/bvemu/lib/python2.6/site-packages/python_memcached-1.45-
>> py2.6.egg/memcache.py", line 697, in _val_to_store_info
>> pickler.dump(val)
>> PicklingError: Can't pickle <class
>> 'django.utils.functional.__proxy__'>: attribute lookup
>> django.utils.functional.__proxy__ failed
>>
>
> But from these last three lines you can deduce that "Can't pickle" is
> telling you the object is not unserializable (only in the failing case). So,
> when we reflect back on the point at which you populated the val you passed
> to the cache backend you will probably find:
>
>
> user_list=User.objects.all()[0:10]
>>>>
>>>
> produces a list of objects that are serializable (ie, your superuser
> account)
>
> and
>
>
> user_list=User.objects.filter(is_staff=False)[0:10]
>>>>
>>>
> is returning an unserializable value possibly? (although pickle.dump([],
> some_object) succeeds, serializing an empty list)
>
> I would have to say it seems like you are passing unexpected data to the
> cacher that is not being validated as serializable and the pickler is
> failing to serialize the invalid data. But this is, just a guess...
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<django-users%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>
>
>
-- You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to [email protected].
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.

