Beispiel #1
0
 def get(self, paste_id):
     try:
         aid = b64.num_decode(paste_id)
         paste = Paste.get_by_id(aid)
         content, lang = paste.content, paste.type
         formatter = HtmlFormatter()
         self.response.out.write(template.render("paste.html", {'css': formatter.get_style_defs('.highlight'),
                                                                'paste': highlight(content, get_lexer_by_name(lang), formatter)}))
     except Exception:
         self.response.set_status(404)
         self.response.out.write(template.render("404.html", {}))