def view_paste_with_extension(paste_id, filetype): query = util.getPaste(paste_id) if not query: return fourohfour() data = query.get('data') mime = util.getMime(mimestr=filetype) data = io.BytesIO(query.get('data')) return Response(data, mimetype=mime)
def view_paste_with_highlighting(paste_id, filetype): query = util.getPaste(paste_id) if not query: return fourohfour() data = query.get('data') mime = util.getMime(mimestr=filetype) print(mime) return render_template('paste.html', paste=data.decode('utf-8'), mime=mime)
def view_paste_with_extension(paste_id, filetype): query = util.getPaste(paste_id) if not query: return fourohfour() if filetype == 'md': data = query.get('data').decode('utf-8') return render_template('markdown.html', paste=data) if filetype == 'rst': data = query.get('data').decode('utf-8') return Response(publish_parts(data, writer_name='html')['html_body']) data = io.BytesIO(query.get('data')) mime = util.getMime(mimestr=filetype) return Response(data, mimetype=mime)