Esempio n. 1
0
def configuration_update():
    configuration_form = ConfigurationForm(request.form)
    
    if configuration_form.validate():
        for key,val in configuration_form.data.iteritems():
            key = key.upper()
            set_config_value(key, val)
        load_config_from_db()
        
    return redirect(url_for('admin_console'))
Esempio n. 2
0
def configuration_update():
    """Updates the configuration values provided by the configuration form
    presented by :func:`admin_console`.
    """
    configuration_form = ConfigurationForm(request.form)

    if configuration_form.validate():
        for key, val in configuration_form.data.iteritems():
            key = key.upper()
            set_config_value(key, val)
        load_config_from_db()

    return redirect(url_for('admin_console'))
Esempio n. 3
0
def configuration_update():
    """Updates the configuration values provided by the configuration form
    presented by :func:`admin_console`.
    """
    configuration_form = ConfigurationForm(request.form)
    
    if configuration_form.validate():
        for key,val in configuration_form.data.iteritems():
            key = key.upper()
            set_config_value(key, val)
        load_config_from_db()
        
    return redirect(url_for('admin_console'))
Esempio n. 4
0
    def test_configuration_update(self):
        give_user_privilege(self.user, "ADMIN_CONFIG")

        form_object = dict(((k.lower(), v) for k, v in app.config.iteritems()))
        configuration_form = ConfigurationForm(**form_object)

        configuration_form.server_port.data = 10000

        response = self.app.post("/admin/config_update",
                                 data=configuration_form.data,
                                 follow_redirects=True)

        assert response.status_code == 200
        assert int(get_config_value("SERVER_PORT")) == 10000
Esempio n. 5
0
def admin_console():
    """Shows the admin console.
    admin.html expects a list of forms for the admin_admin functions,
    a dict of user ids and names, a configuration form, the current user,
    and the privileges a user has.
    """
    user = User.query.get(session['user']['id'])

    form_object = dict(((k.lower(), v) for k, v in app.config.iteritems()))

    configuration_form = ConfigurationForm(request.form, **form_object)

    admin_admin_forms = create_admin_admin_form()
    user_ids_to_names = dict((u.id, u.name) for u in User.query.all())

    return render_template("admin.html",
                           admin_admin_forms=admin_admin_forms,
                           user_ids_to_names=user_ids_to_names,
                           configuration_form=configuration_form,
                           user=user,
                           user_privs=dump_user_privileges(user))