Beispiel #1
0
    def get(self):
        items = db.GqlQuery("SELECT * FROM NewsItem ORDER BY date DESC LIMIT 25")
 
        context = add_user_to_context({'news':items }) 
        #context = add_user_to_context(context)
        self.response.out.write(
               template.render(tmpl('templates/news2.html'),
               context ))
Beispiel #2
0
 def get(self):     
     url = cgi.escape(self.request.get('url'))
     if not url: 
        self.response.out.write('Please pass a feed-url as a get-param "url".')
     try: 
        result = urlfetch.fetch(url)
     except: 
        self.response.out.write('Invalid or non-existing URL.')
         
     
     if result.status_code == 200:
         rssfeed = feedparser.parse(result.content)
         self.response.out.write(
            template.render(tmpl('templates/admin/feedpreview.html'),
            {'feed': rssfeed} ))
     else:  
         self.response.out.write('error') 
Beispiel #3
0
    def get(self): 
        url = settings.YAHOO_PIPE % 'rss'  
        result = urlfetch.fetch(url) 
        if result.status_code == 200:
            feed = feedparser.parse(result.content) 
            for i in feed.entries:  
                item = NewsItem(key_name=i.guid) 
                item.url = i.link
                item.title = i.title 
                item.text = i.summary
                item.date = datetime.datetime(*i.date_parsed[:6])
                item.orderdate = datetime.datetime(*i.date_parsed[:6])
                item.put() 

            items = db.GqlQuery("SELECT * FROM NewsItem ORDER BY orderdate DESC LIMIT 100")
 
            context = {'news':items }
            #context = add_user_to_context(context)
            self.response.out.write(
               template.render(tmpl('templates/news2.html'),
               context ))
        else: 
            self.response.out.write('err') 
Beispiel #4
0
 def get(self):
     v = Videos.all()[0]
     context = add_user_to_context({ 'users': v.users, 'searches': v.searches  }) 
     self.response.out.write(
         template.render(tmpl('templates/video.html'),
         context ))
Beispiel #5
0
 def get(self):
     context = { }
     self.response.out.write(
         template.render(tmpl('templates/map.html'),
         context ))
Beispiel #6
0
 def get(self):
     t = Twitter.all()[0]
     context = add_user_to_context({'keywords': t.keywords  }) 
     self.response.out.write(
         template.render(tmpl('templates/twitter.html'),
         context ))
Beispiel #7
0
 def get(self):
     context = { }
     #context = add_user_to_context(context)
     self.response.out.write(
         template.render(tmpl('templates/twitter.html'),
         context ))