Hi,
I'm back again with an issue that I got since upgrading to queryset-
refactor. That issue appears at run time. Every page on my site caches
the sidebar, which contains some expensive randomly generated content.
Since I upgraded to qs-rf I get the following error for every page of
the site:
Exception Type: PicklingError at /
Exception Value: Can't pickle <type 'function'>: attribute lookup
__builtin__.function failed
Here's the traceback:
File "E:\Software\workspace\django\django\core\handlers\base.py" in
get_response
82. response = callback(request, *callback_args,
**callback_kwargs)
File "E:\Software\workspace\django\django\utils\decorators.py" in
_wrapped_view
48. response = view_func(request, *args, **kwargs)
File "E:\Software\workspace\MYSITE\trunk\news\views.py" in frontpage
26. sidebar = populateSidebar(request)
File "E:\Software\workspace\MYSITE\trunk\news\views.py" in
populateSidebar
189. cache.set('sidebar', sidebar, 60 * 2)
File "E:\Software\workspace\django\django\core\cache\backends
\filebased.py" in set
68. pickle.dump(value, f, pickle.HIGHEST_PROTOCOL)
Now here's the function that seems to pose probem:
def populateSidebar(request=None):
cached_sidebar = cache.get('sidebar')
if cached_sidebar:
return cached_sidebar
else:
sidebar = {}
sidebar["countries"] =
Country.objects.exclude(id=1).order_by('name')
sidebar["photo"] =
FlickrPhoto.objects.filter(aspect_ratio__gte=1).order_by('?')[0]
cache.set('sidebar', sidebar, 60 * 2)
return sidebar
I apologise for posting a piece of my code rather than a standalone
working example, but the error seems to come from the cache.set()
method so I guess the issue should "easily" be reproduced.
Any idea what's wrong here?
Thanks heaps!
Julien
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---