Hi,

I'm doing file caching and it's working pretty well. However, today
within 6 minutes I've received 14 errors by email (my site runs with
DEBUG=False), all very similar to:

 File "/MYPATH/django/core/handlers/base.py", line 82, in get_response
   response = callback(request, *callback_args, **callback_kwargs)

 File "/MYPATH/django/views/generic/date_based.py", line 341, in
object_detail
   c[key] = value()

 File "/MYPATH/news/views.py", line 212, in populateSidebar
   cached_sidebar = cache.get('sidebar')

 File "/MYPATH/django/core/cache/backends/filebased.py", line 47, in
get
   return pickle.load(f)

AttributeError: 'dict' object has no attribute 'append'


The issue is apparently in the following function:

def populateSidebar(request=None):
    cached_sidebar = cache.get('sidebar')
    if cached_sidebar is not None and settings.CACHE_ENABLED:
        return cached_sidebar
    else:
        sidebar = {}
        sidebar["countries"] = [country for country in
Country.objects.exclude(id=1).order_by('name')]
        sidebar["photo"] =
FlickrPhoto.objects.filter(aspect_ratio__gte=1).order_by('?')[0]
        if settings.CACHE_ENABLED:
            cache.set('sidebar', sidebar, settings.SIDEBAR_CACHE_TIME)
        return sidebar


Again, it works pretty much all the time, but apparently it crashed a
few times within a short time (6 minutes).
What could have caused that, and how could I avoid it? Any help or
advice would be much appreciated.

Note that I'm using file caching for many other views/functions of the
site, and none of them have generated any error so far.

Thanks a lot!!

Julien
--~--~---------~--~----~------------~-------~--~----~
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