|
| 1 | +"""Example 004: Embeding a clickwrap""" |
| 2 | + |
| 3 | +from os import path |
| 4 | + |
| 5 | +from flask import request, render_template, Blueprint, session |
| 6 | + |
| 7 | +from .controller import Eg004Controller |
| 8 | +from app.docusign import authenticate |
| 9 | +from app.ds_config import DS_CONFIG |
| 10 | + |
| 11 | +eg = "eg004" # reference (and url) for this example |
| 12 | +eg004 = Blueprint("eg004", __name__) |
| 13 | + |
| 14 | + |
| 15 | +@eg004.route("/eg004", methods=["GET", "POST"]) |
| 16 | +@authenticate(eg=eg) |
| 17 | +def embed_clickwrap(): |
| 18 | + """ |
| 19 | + 1. Get required arguments |
| 20 | + 2. Render the response |
| 21 | + """ |
| 22 | + # 1. Get required arguments |
| 23 | + args = Eg004Controller.get_args() |
| 24 | + show_clickwrap = True if request.method == 'POST' else False |
| 25 | + |
| 26 | + # 2. Render template |
| 27 | + return render_template( |
| 28 | + "eg004_embed_clickwrap.html", |
| 29 | + title="Embeding a clickwrap", |
| 30 | + account_id=args.get('account_id'), |
| 31 | + client_user_id=DS_CONFIG.get('signer_email'), |
| 32 | + clickwrap_id=args.get('clickwrap_id'), |
| 33 | + clickwrap_ok=session.get("clickwrap_id") and session.get("clickwrap_is_active"), |
| 34 | + show_clickwrap=show_clickwrap, |
| 35 | + source_file=path.basename(path.dirname(__file__)) + "/controller.py", |
| 36 | + source_url=DS_CONFIG["github_example_url"] + path.basename( |
| 37 | + path.dirname(__file__)) + "/controller.py", |
| 38 | + ) |
0 commit comments