I've just upgraded some code to Django 1.0 and the caching stopped working.
I have found a fix but I don't understand what's happening so if anyone can explain, I'd be grateful. My code used to look somthing like this (simplified for clearer reading) cached=cache.get(key) if cached: list=pickle.loads(cached) else: list = Banks.objects() pickled = pickle.dumps(list,pickle.HIGHEST_PROTOCOL) cache.set(key,pickled) pickled is of type 'str', my default encoding appears to be 'ascii'. When I call cache.set, I get a UnicodeDecodeError. So to fix it, I add: cached=smart_str(cached,encoding='iso_8859_1') before the call to pickle.loads() and pickled=smart_unicode(pickled,encoding='iso_8859_1') before the call to cache.set() So what I don't understand is, why 'iso_8859_1'? As far as I know, the python default encoding is 'ascii' and the django DEFAULT_CHARSET is 'utf-8'. So where's this coming from? Any pointers welcome! Rachel --~--~---------~--~----~------------~-------~--~----~ 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---