def get(self, name): try: template = jinja_environment.get_template(name + ".html") except IOError: self.response.set_status(404) template = jinja_environment.get_template("404.html") return self.response.out.write(template.render({"is_pc": is_pc()}))
def get(self, entry_id): entry = Entry.get_entry(entry_id) if entry is None: self.response.set_status(404) template = jinja_environment.get_template("404.html") return self.response.out.write(template.render({})) entries = Entry.get_entry_titles() index = [e.key for e in entries].index(entry.key) previous_entry = entries[index - 1] if index > 0 else None next_entry = entries[index + 1] if index < len(entries) - 1 else None Entry.increment_views(entry_id) template = jinja_environment.get_template("blog_entry.html") return self.response.out.write( template.render( { "is_pc": is_pc(), "entry": entry, "previous": previous_entry, "next": next_entry, "request_url": self.request.url, } ) )
def get(self): self.response.set_status(404) template = jinja_environment.get_template("404.html") return self.response.out.write(template.render({"is_pc": is_pc()}))
def get(self): template = jinja_environment.get_template("blog_list.html") return self.response.out.write(template.render({"is_pc": is_pc(), "entries": Entry.get_entries()}))
def get(self): template = jinja_environment.get_template("index.html") return self.response.out.write(template.render({"is_pc": is_pc(), "recent_entries": Entry.get_entries(num=5)}))