I'm a beginner at web2py, webapps, and Python in general and am having
trouble and was hoping I could get some guidance here.
I'm looking to have a page in my app that simply displays a simple list of
RSS feeds. I eventually want to make something more robust but this is the
key starting thing I need to learn how to do.
My app contains these files:
controllers/default.py
views/reddit.py (I'm just using Reddit for now because of the readily
available RSS feed)
*default.py control code:*
import feedparser
def reddit():
d = feedparser.parse('http://www.reddit.com/r/python/.rss')
content_feed = []
content_entry = []
for feed in d:
#print post.title + ": " + post.link + "\n"
content_feed.append(feed.title)
return dict(content=content_feed)
*reddit.html view code:*
{{extend 'layout.html'}}
<h1>Latest Reddit Feeds</h1>
<ul>
{{for feed in content:}}
{{=LI(feed)}}
{{pass}}
</ul>
*The result when I view the reddit.html page is:*
Latest Reddit Feeds
- <built-in method title of str object at 0x203f4e0>
- <built-in method title of str object at 0x1db75d0>
- <built-in method title of str object at 0x7f1af80b1270>
- <built-in method title of str object at 0x7f1af8096ea0>
- <built-in method title of str object at 0x7f1abc12b030>
- <built-in method title of str object at 0x1db7390>
- <built-in method title of str object at 0x22912a0>
- <built-in method title of str object at 0x7f1abc143de0>
- <built-in method title of str object at 0x20bacf0>
So it looks like it is displaying references to each entry but not the
actual feed titles in the string format I was expecting.
Help! : )
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.