Example #1
0
def get_builder(regulation, version, inline_applier, p_applier, s_applier):
    """ Returns an HTML builder with the appliers, and the regulation tree. """
    builder = HTMLBuilder(inline_applier, p_applier, s_applier)
    builder.tree = get_regulation(regulation, version)
    return builder
Example #2
0
# -*- encoding: utf-8 -*-

from html_form_parser import HTMLFormParser
from html_builder import HTMLBuilder
from db_client import DBClient
from flask import Flask, request, render_template, redirect, url_for
import json

app = Flask(__name__)
d = DBClient()
hfp = HTMLFormParser()
hb = HTMLBuilder()


@app.route('/', methods=['GET', 'POST'])
def list_of_verbs():
    if request.method == 'POST':
        v_id = request.form["delete"]
        d.delete(v_id)
        return '{"result":"success"}'
    words = d.all_words()
    return render_template('index.html', words=words, results=False)


@app.route('/add', methods=['GET', 'POST'])
def add():
    if request.method == 'POST':
        for_db = hfp.parse_form(dict(request.form))
        d.add(for_db)
        return '{"result":"success"}'
    page = hb.create_html(d.empty_form_fields(), mode='add')