def GET(self, original, new, raw=None): try: original = Pasted.get(original) new = Pasted.get(new) except: web.seeother('/') return diff = create_udiff(original, new) if raw is not None: web.header('content-type', 'text/plain; charset=utf-8') return diff else: diff = render_udiff(diff) return render.base(render.diff(original, new, diff))
def GET(self, paste_id): try: original = Pasted.get(paste_id) except: web.seeother('/') return render.base(render.form(original))
def GET(self, paste_id, mode=None): try: paste = Pasted.get(paste_id) paste.viewed_at = datetime.datetime.now().strftime('%Y-%m-%d %H:%M') except: web.seeother('/') return if mode is not None: if mode == '.txt': web.header('content-type', 'text/plain; charset=utf-8') return paste.code elif mode == '.colorful': colorful_code = syntax_highlight(paste) if colorful_code is None: web.seeother('/view/'+str(paste.id)) else: return render.base(render.view(paste,colorful_code)) else: return render.base(render.view(paste))