def rst2pdf(): rst = request.form.get('rst', '') theme = request.form.get('theme') if theme == 'basic': theme = None pdf = _rst2pdf(rst, theme=theme) responce = make_response(pdf) responce.headers['Content-Type'] = 'application/pdf' responce.headers['Content-Disposition'] = 'attachment; filename="rst.pdf"' responce.headers['Content-Transfer-Encoding'] = 'binary' return responce