Django feeds sometimes generate AttributeError: 'LatestStripsByStripConfig' object has no attribute '__name __'

41 views
Skip to first unread message

marty3d

unread,
Nov 25, 2010, 9:38:07 AM11/25/10
to Django users
Hi!

My site have started to behave a little weird.

Lately, I get two or three errors per day, saying:
Traceback (most recent call last):

File "/home/mistalaba/.virtualenvs/production/lib/python2.5/site-
packages/django/core/handlers/base.py", line 95, in get_response
response = middleware_method(request, callback, callback_args,
callback_kwargs)

File "/home/mistalaba/.virtualenvs/production/lib/python2.5/site-
packages/django/middleware/doc.py", line 18, in process_view
response['X-View'] = "%s.%s" % (view_func.__module__,
view_func.__name__)

AttributeError: 'LatestStripsByStripConfig' object has no attribute
'__name__'

I don't know why this is appearing all of a sudden, I haven't changed
the code, but I don't know where to start debugging this.

Here is my feeds.py, rather straightforward:
from django.contrib.syndication.views import Feed
from django.shortcuts import get_object_or_404

from strip.models import StripConfig, Strip

class LatestStripsByStripConfig(Feed):
#__name__ = 'LatestStripsByStripConfig'
description_template = 'feeds/latest_description.html'

def get_object(self, request, stripconfig):
return get_object_or_404(StripConfig, slug=stripconfig)

def title(self, obj):
return "Scandinavian Comics RSS feed for %s" % obj.strip_name

def link(self, obj):
return "%s?utm_source=feed&utm_medium=%s" %
(obj.get_absolute_url(), obj.strip_name)

def description(self, obj):
return "The latest %s comic strips. See more at
http://www.scandinavian-comics.com/strips/" % obj.strip_name

def items(self, obj):
return
Strip.objects.filter(strip_config__slug=obj.slug).order_by('-date')[:
10]

def item_link(self, item):
return "%s?utm_source=feed&utm_medium=%s&utm_campaign=%s" %
(item.get_absolute_url(), item.strip_config, item)


Does anyone have some wise suggestions? I would really appreciate it!
Thank you!

Łukasz Rekucki

unread,
Nov 25, 2010, 9:42:05 AM11/25/10
to django...@googlegroups.com
Well, something must have changed if you didn't had the problem
before. What version of Django are you running ?

> --
> You received this message because you are subscribed to the Google Groups "Django users" group.
> To post to this group, send email to django...@googlegroups.com.
> To unsubscribe from this group, send email to django-users...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
>
>

--
Łukasz Rekucki

marty3d

unread,
Nov 25, 2010, 4:06:17 PM11/25/10
to Django users
It's 1.2.3. I have two ideas, either it could be the cache (started
using filesystem cache a week ago) or I'm using a stupid query for
returning the queryset (aka database performance issue).

Have anyone heard of caching messing with the feeds system?

/Martin

On Nov 25, 3:42 pm, Łukasz Rekucki <lreku...@gmail.com> wrote:
> Well, something must have changed if you didn't had the problem
> before. What version of Django are you running ?
>

marty3d

unread,
Nov 26, 2010, 4:35:28 AM11/26/10
to Django users
I have disabled cache and still getting the error. That
leaves...what? :/

I could really appreciate some help debugging this.

Thank you,
/Martin

On Nov 25, 10:06 pm, marty3d <martin.kjellb...@gmail.com> wrote:
> It's 1.2.3. I have two ideas, either it could be the cache (started
> using filesystem cache a week ago) or I'm using a stupid query for
> returning the queryset (aka database performance issue).
>
> Have anyone heard of caching messing with the feeds system?
>
> /Martin
>
> > £ukasz Rekucki
>
>

Łukasz Rekucki

unread,
Nov 26, 2010, 4:59:08 AM11/26/10
to django...@googlegroups.com
On 26 November 2010 10:35, marty3d <martin.k...@gmail.com> wrote:
> I have disabled cache and still getting the error. That
> leaves...what? :/
>
> I could really appreciate some help debugging this.

On a closer look, this looks like:
http://code.djangoproject.com/ticket/13842 ; But then, you must have
changed something in your code/settings (like migrating from Django
1.1 syndication views or adding XView).


--
Łukasz Rekucki

marty3d

unread,
Nov 27, 2010, 9:39:08 AM11/27/10
to Django users
The XView middleware was the culprit. After removing that, the issues
completely disappeared. For some reason it was added as default (this
could have been in 1.1, I don't know), and I never used it, so it was
no loss at all :)

Thank you!
/Martin

On Nov 26, 10:59 am, Łukasz Rekucki <lreku...@gmail.com> wrote:
Reply all
Reply to author
Forward
0 new messages