def post_update_kit(kit_id): form = UpdateForm(csrf_enabled=False) form.init() form.process(request.form) kit_file = request.files["kit_file"] if form.validate(): json = { "request": { "substance": { "kit_id": form.kit_id.data, "kit_name": form.kit_name.data, "category_id": form.category_id.data, "tags": unicode(form.tags.data).split(","), "description": form.description.data, "kit_file": kit_file, "valid": True if form.valid.data == "True" else False, } } } req = json.get("request") ret = KitFacade.update(req, secure=False).get("response") if ret and ret.get("result") == const.RESPONSE_RESULT_SUCCESSFUL: return redirect("/admin/author/update/" + form.author_id.data) else: form.errors["exceptions"] = [ret.get("message")] return render_template("kit/update.html", form=form)
def update_kit(): json = { "request": { "credential": { "author_id": "a2e006bc0d489746ee6ac9415da7ef352091bbe8", "token": "b941295b36824f0fc19cc473ba9d6b67866b2709" }, "substance": { "kit_id": "3b1efa98eac78dd9a887b949c07bc739fcd2d044", "kit_name": u"My Wonderful Kit Review!", "category_id": "c1ac4c51afdd9ed6df0d3d871d38f261b70dcba8", "tags": [u"geo"], "description": u"これはmodoの素晴らしいキットです。\nみなさんぜひご利用ください。\n内容を改変しました。", "valid": True, } } } req = json.get("request") res = KitFacade.update(req) return jsonify(res)