List Info

Thread: Getting exception when trying to generate feed




Getting exception when trying to generate feed
user name
2007-12-20 11:26:21
I am trying to generate a feed.
So I added the following lines to urls.py

feeds = {'latest': main_feed}
urlpatterns += patterns('',
      (r'^rss/(?P<url>.*)/$',
'django.contrib.syndication.views.feed',
{'feed_dict': feeds})
      )

The class main_feed is,

def main_feed (Feed):
    blog = Blog.objects.all()[0]
    title = blog.title
    link = "/rss/latest/"
    description = blog.description
    def items (self):
       entries = BlogEntry.entry.all()[:blog.recents * 2]
       return entries

Now I should be getting the feed at /rss/latest/ , but I am
getting an
error like
TypeError at /rss/latest/
main_feed() takes exactly 1 argument (2 given)

Full error stack,
Traceback:
File
"C:Python24libsite-packagesdjangocorehandlersbas
e.py" in
get_response
  82.                 response = callback(request,
*callback_args,
**callback_kwargs)
File
"C:Python24libsite-packagesdjangocontribsyndicati
on
views.py" in feed
  19.         feedgen = f(slug, request).get_feed(param)

Exception Type: TypeError at /rss/latest/
Exception Value: main_feed() takes exactly 1 argument (2
given)

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


Re: Getting exception when trying to generate feed
user name
2007-12-20 12:36:15
> The class main_feed is,
>
> def main_feed (Feed):

That should be:

class main_feed(Feed):

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


[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )