Beispiel #1
0
def deleteAppl(name, group_name, url_back):
    """
    delete application-site

    delete an existing application-site

    arguments:
        app_list: the id number of the application-site groups

    return: renders the show application-sites page
    """
    appl = APIObject(name, 'application-site')
    appl.name = appl.name[5:]
    appl_to_delete = appl.show()

    if request.method == 'POST':

        appl.delete_from_group('set-application-site-group', group_name)

        api.api_call('publish')
        flash(u'Aplicació eliminada')
        return redirect(url_for(url_back))

    return render_template(
        'delete-appl.html',
        group_name=group_name,
        appl_to_delete=appl_to_delete,
        url_back=url_back)
Beispiel #2
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 editada')
        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)
Beispiel #3
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('Equip editat')
        return redirect(url_for(url_back))

    return render_template(
        'edit-host.html',
        form=form,
        host_to_edit=host_to_edit,
        url_back=url_back)
Beispiel #4
0
def deleteHost(name, group_name, url_back):
    """delete host

    Delete an existing host

    Arguments:
        name - the name of the host to be deleted
        group_name - the name of the group where the host belongs
        url_back - url for redirecting when finished

    Return: if POST delete the host, if GET render the delete host page
    """
    host = APIObject(name, 'host')
    host_to_delete = host.show()

    if request.method == 'POST':
        host.delete_from_group('set-group', group_name)
        host.delete()

        api.api_call('publish')
        flash('Equip eliminat')
        return redirect(url_for(url_back))

    return render_template(
        'delete-host.html',
        group_name=group_name,
        host_to_delete=host_to_delete,
        url_back=url_back)
Beispiel #5
0
def deleteApplicationSite(name, group_name, url_back):
    """
    delete application-site

    delete an existing application-site

    arguments:
        app_list: the id number of the application-site groups

    return: renders the show application-sites page
    """
    appl = APIObject(name, 'application-site')
    appl_to_delete = appl.show()

    if request.method == 'POST':

        appl.delete_from_group('set-application-site-group', group_name)

        if appl.where_used() >= 2:
            api.api_call('publish')
            flash(
                u"The URL belongs to more lists, it is not completely deleted")
            return redirect(url_for(url_back))

        appl.delete_from_group('set-application-site-group', 'APGR_GENERAL')

        appl.delete()

        api.api_call('publish')
        flash(u'URL removed')
        return redirect(url_for(url_back))

    return render_template('delete-application-site.html',
                           group_name=group_name,
                           appl_to_delete=appl_to_delete,
                           url_back=url_back)
Beispiel #6
0
def deleteApplicationSite(name, group_name, url_back):
    """
    delete application-site

    delete an existing application-site

    arguments:
        app_list: the id number of the application-site groups

    return: renders the show application-sites page
    """
    appl = APIObject(name, 'application-site')
    appl_to_delete = appl.show()

    if request.method == 'POST':

        appl.delete_from_group('set-application-site-group', group_name)

        if appl.where_used() >= 2:
            api.api_call('publish')
            flash(u"La URL pertany a més llistes, no s'elimina totalment")
            return redirect(url_for(url_back))

        appl.delete_from_group('set-application-site-group', 'APGR_GENERAL')

        appl.delete()

        api.api_call('publish')
        flash(u'URL eliminada')
        return redirect(url_for(url_back))

    return render_template(
        'delete-application-site.html',
        group_name=group_name,
        appl_to_delete=appl_to_delete,
        url_back=url_back)