please much suggestions thank you
On May 28, 4:37 pm, sebastian stephenson <[EMAIL PROTECTED]> wrote:
> great finally some help thank you so much!
> On 28 May 2008, at 15:20, Rajesh Dhawan wrote:
>
>
>
>
>
> > On May 28, 6:30 am, sebey <[EMAIL PROTECTED]> wrote:
> >> from django.http import HttpResponse
> >> import feedparser
> >> from ubermicro.shows.models import show
>
> >> def show_page(request):
> >> """this is where we take what we need form the rss feeds in the
> >> data base"""
> >> query = show.objects.filter(show_feed__contains="http://")
> >> podcast = feedparser.parse(query)
>
> > It seems that you are making feedparser parse an instance of a Django
> > ORM query. I think what you want to do is to make it parse a URL. May
> > be something like this:
>
> > for q in query:
> > podcast = feedparser.parse(q.show_feed)
> > if podcast.entries:
> > show_latest_title = podcast.entries[0].title
>
> > This will do it for all objects in your query. So you will have to
> > collect that list of titles etc. in a collection of some kind (list,
> > dict, etc.) and pass it on to your template.
>
> >> #show_about = podcast.feed.description
> >> show_latest_title = podcast.entries[0].title
>
> > The above statement assumes that there is at least one entry in the
> > feed. That may not be always true. So, you should consider testing
> > that first. Something like:
>
> > if podcast.entries:
> > show_latest_title = podcast.entries[0].title
>
> >> #show_latest = podcast.entries[0].description
>
> >> return HttpResponse(show_latest_title)
>
> >> this code is what I think its doing is that I am grabing the rss url
> >> then using feedparser (http://www.feedparser.org) to get rss element
> >> such as <description> and such but every time I try to do this I get
> >> this error
>
> >> Traceback (most recent call last):
> >> File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
> >> python2.5/
> >> site-packages/django/core/handlers/base.py" in get_response
> >> 77. response = callback(request, *callback_args, **callback_kwargs)
> >> File "/Users/sebey/Sites/ubermicro/../ubermicro/shows/views.py" in
> >> show_page
> >> 10. show_latest_title = podcast.entries[0].title
>
> >> IndexError at /shows/
> >> list index out of range
> >> I am to django programing web dev etc. but I guess that the query
> >> I am
> >> useing is not correct so I what should I do thanks
>
> > -Rajesh
>
> see ya
>
> sebey
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---