def update_lastpost(): q = models.BlogPost.all().order('-published') q.filter('published !=', datetime.datetime.max)# Filter drafts out post = q.get() postobj = {} postobj['path'] = post.path postobj['title'] = post.title postobj['summary'] = utils.absolutify_url(post.summary) postobj['tag_pairs'] = post.tag_pairs postobj['pubdate'] = post.published.strftime('%B %d, %Y') static.set('/lastpost.json', json.dumps(postobj, indent=4), 'text/plain; charset=utf-8', indexed=False, last_modified=post.published_tz.replace(second=0, microsecond=0))
def post(self, post): # Create feed entry. feed_entry = models.FeedEntry.get_by_key_name( 'feed_for_post:%d' % post.key().id()) if feed_entry is None: created = True feed_entry = models.FeedEntry( key_name = 'feed_for_post:%d' % post.key().id(), title = post.title, postpath = post.path, body = utils.absolutify_url(post.summary), published = post.published ) else: created = False feed_entry.title = post.title feed_entry.postpath = post.path feed_entry.body = utils.absolutify_url(post.summary) feed_entry.published = post.published feed_entry.put() self.render_to_response("feeded.html", {'created': created, 'post': post})