Exemple #1
0
def setApplicationSite(name, url_back):
    """
    edit host

    edits an existing host

    arguments:
        object_uid:

    return: renders the show group members page
    """
    form = ApplicationSiteForm(request.form)

    appl = APIObject(name, 'application-site')
    appl_to_edit = appl.show()

    if request.method == 'POST' and form.validate():
        appl.edit(new_name=app.config['ID_COLE'] + 'APPL_' + form.name.data,
                  url_list=form.url_list.data)
        api.api_call('publish')
        flash('URL edited')
        return redirect(url_for(url_back))

    return render_template('edit-application-site.html',
                           form=form,
                           appl_to_edit=appl_to_edit,
                           url_back=url_back)
Exemple #2
0
def setHost(name, url_back):
    """edit host

    Edit an existing host

    Arguments:
        name - name of the host to be edited
        url_back - url for redirecting when finished

    Return: if form validates edit the host, if doesn't show a page with the
        errors
    """
    form = HostForm(request.form)

    host = APIObject(name, 'host')
    host_to_edit = host.show()

    if request.method == 'POST' and form.validate():
        host.edit(new_name=app.config['ID_COLE'] + 'HOST_' + form.name.data,
                  ipv4_address=form.ipv4_address.data)
        api.api_call('publish')
        flash('Edited team')
        return redirect(url_for(url_back))

    return render_template('edit-host.html',
                           form=form,
                           host_to_edit=host_to_edit,
                           url_back=url_back)