So.. I want to fill database with 2 fields: Link, Title.
This information i take from rss-parser.
Bu database do not filling.

<code>
import feedparser
import os
from google.appengine.ext import webapp, db
from google.appengine.ext.webapp.util import run_wsgi_app
from google.appengine.ext.webapp import template

class LjShort(db.Model):
    link = db.LinkProperty()
    title = db.StringProperty()


class Feed(webapp.RequestHandler):
    def get(self):
        ljfeed = LjShort()

        feed = feedparser.parse('someRSSlink')
        for i in feed.entries:
            ljfeed.link = i.link
            try:
                ljfeed.title = i.title
            except:
                ljfeed.title = 'No title...'
            ljfeed.put()
        self.redirect('/')


class FeedPage(webapp.RequestHandler):
    def get(self):
        lj_query = LjShort().all()

        template_values = {
            'lj_post': lj_query,
        }
        path = os.path.join(os.path.dirname(__file__), 'feed.html')
        self.response.out.write(template.render(path,
template_values))

application = webapp.WSGIApplication(
    [('/', FeedPage),
        ('/feed', Feed)],
    debug = True
)

def main():
    run_wsgi_app(application)

if __name__ == '__main__':
    main()
</code>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to