def get(self): query = CloseApproach.all().order('-approach_date') fetch_count = 20 close_approaches = query.fetch(fetch_count) values = { 'close_approaches': close_approaches, 'fetch_count': fetch_count } path = os.path.join(os.path.dirname(__file__), 'main.html') self.response.out.write(template.render(path, values))
def get(self): query = CloseApproach.all().order('-approach_date') close_approaches = query.fetch(20) feed_items = [] base_url = 'http://justmissedearth.appspot.com' # TODO: Clean this up for ca in close_approaches: feed_items.append(PyRSS2Gen.RSSItem( title = '"%s" just missed earth...' % ca.object_name, link = '%s/misses/%s' % (base_url, ca.key()), description = self._render_feed_description(ca), guid = PyRSS2Gen.Guid('%s/misses/%s' % (base_url, ca.key())), pubDate = ca.approach_date)) rss = PyRSS2Gen.RSS2( title = "just missed earth - latest misses", link = "%s/feed" % base_url, description = "just missed earth - latest misses", lastBuildDate = datetime.now(), items = feed_items) self.response.headers['Content-Type'] = 'application/rss+xml' self.response.out.write(rss.to_xml(encoding = 'utf-8'))