Пример #1
0
    def get(self, post_id):
        post_lookup = Post.get_by_id(int(post_id))

        if post_lookup:
            self.render(post_lookup=post_lookup)

        else:
            self.write("Sorry, Page could not be found. Please try again.")
Пример #2
0
    def get(self, post_id):
        post_lookup = Post.get_by_id(int(post_id))

        if post_lookup:
            queried = last_queried(post_id)
            self.render(post_lookup=post_lookup, last_queried = queried)

        else:
            self.write("Sorry, Post could not be found. Please try again.")
Пример #3
0
    def get(self, post_id):
        post_key = 'POST_' + post_id

        post, age = utils.age_get(post_key)
        if not post:
            post = Post.get_by_id(long(post_id))
            if not post:
                self.response.write('This page doesn\'t exist!')
            utils.age_set(post_key, post)
            age = 0

        if self.request.url.endswith('.json'):
            self.response.headers['Content-Type'] = ('application/json; '
                                                     'charset=UTF-8')
            p = {'content': post.content,
                 'created': post.created.strftime('%c'),
                 'subject': post.subject}
            self.response.write(json.dumps(p))
        else:
            self.render('/templates/permanent.html',
                        post=post,
                        age=utils.age_str(age))