def update():
    connection = g.connection
    for k in categories.iterkeys():
        get(k)
    connection.cursor.execute('DROP TABLE Parameter')
    connection.cursor.execute('DROP TABLE ParameterDictionary')
    initialize_parameters(connection)
    initialize_parameter_dictionaries(connection)
    read_parameters(connection)
    read_parameter_dictionaries(connection)
    return redirect(url_for('parameters'))
Exemple #2
0
from flask import Flask, render_template, url_for, redirect, g
from flask_mvc.model.sqlite import Connection
from pmgmt.controllers.parameters import parameters, parameter
from pmgmt.controllers.parameter_dictionaries import parameter_dictionaries, parameter_dictionary
from pmgmt.controllers.update import update
from pmgmt.util.config import read_config

config = read_config()
connection = Connection(config['database'])
if config['database']==':memory:':
    from pmgmt.model.model import initialize_parameter_relations, initialize_parameters, initialize_parameter_dictionaries, read_parameters, read_parameter_dictionaries
    initialize_parameters(connection)
    initialize_parameter_dictionaries(connection)
    initialize_parameter_relations(connection)

    read_parameters(connection)
    read_parameter_dictionaries(connection)

app = Flask('monitor', template_folder=config['template_folder'], static_folder=config['static_folder'])


@app.before_request
def before_request():
    g.connection = connection

@app.teardown_request
def teardown_request(exception):
    g.connection.commit()

@app.route('/')
def index():