def preview(): params = request.args.get("params") resp = request.args.get("resp") lang = request.args.get("lang") sample = sample_params(params) try: ret = render_args(lang, resp, sample) except Exception, e: return str(e)
def apigen(apigen_id=None): gr = apigen_id and GetRequest.query.get(apigen_id) if not gr: abort(404) params = json.loads(gr.params) result = change_dict(params, request.args) resp = gr.resp if gr.lang == 'mako': resp = '<%!from apigen.template_module import get_pic, get_words, get_random%>'+resp try: return render_args(gr.lang, resp, result) except TypeError: abort(400)