def create_author():
    json = {
        "request": {
            "substance": {
                "author_name": u"Masahiro Atsumi",
                "mail_address": "*****@*****.**",
                "password": "******"
            }
        }
    }
    #    json = {
    #        "request": {
    #            "credential": {
    #                "author_id": "*****@*****.**",
    #                "token": "1234567890abcde",
    #                },
    #            "substance": {
    #                "author_name": u"渥美政廣",
    #                "mail_address": "*****@*****.**",
    #                "password": "******"
    #            }
    #        }
    #    }

    req = json.get("request")
    res = AuthorFacade.create(req)
    return jsonify(res)
def post_create_author():
    form = CreateForm(request.form, csrf_enabled=False)
    if form.validate():
        json = {
            "request": {
                "substance": {
                    "author_name": form.author_name.data,
                    "mail_address": form.mail_address.data,
                    "password": form.password.data,
                }
            }
        }
        req = json.get("request")
        ret = AuthorFacade.create(req).get("response")
        if ret and ret.get("result") == const.RESPONSE_RESULT_SUCCESSFUL:
            return redirect("/admin/author/list")
        else:
            form.errors["exceptions"] = [ret.get("message")]
    return render_template("author/create.html", form=form)