Ejemplo n.º 1
0
def get_update_password_author(author_id):
    json = {
        "request": {
            "substance": {
                "author_id": author_id,
            }
        }
    }
    req = json.get("request")
    ret = AuthorFacade.read(req).get("response")
    if not ret or ret.get("result") != const.RESPONSE_RESULT_SUCCESSFUL:
        return redirect("/admin/author/create")

    form = UpdatePasswordForm(csrf_enabled=False)
    form.author_id.data = author_id

    json = {
        "request": {
            "substance": {
                "author_id": author_id
            }
        }
    }
    req = json.get("request")
    res = KitFacade.list(req)
    kits = res.get("response").get("substance").get("items")
    return render_template("author/update_password.html", form=form, kits=kits)
Ejemplo n.º 2
0
def update_author(author_id):
    form = UpdateForm(csrf_enabled=False)
    json = {
        "request": {
            "substance": {
                "author_id": author_id,
            }
        }
    }
    req = json.get("request")
    ret = AuthorFacade.read(req).get("response")
    if ret and ret.get("result") == const.RESPONSE_RESULT_SUCCESSFUL:
        substance = ret.get("substance")

        form.author_id.data = substance.get("author_id")
        form.author_name.data = substance.get("author_name")
        form.mail_address.data = substance.get("mail_address")
        form.valid.data = str(substance.get("valid"))
    else:
        return redirect("/admin/author/create")

    json = {
        "request": {
            "substance": {
                "author_id": author_id
            }
        }
    }
    req = json.get("request")
    res = KitFacade.list(req)
    kits = res.get("response").get("substance").get("items")
    return render_template("author/update.html", form=form, kits=kits)
Ejemplo n.º 3
0
def read_author():
    json = {
        "request": {
            "substance": {
                "author_id": "a2e006bc0d489746ee6ac9415da7ef352091bbe8",
                }
        }
    }

    req = json.get("request")
    res = AuthorFacade.read(req)
    return jsonify(res)