def searchmatch(): form = SearchForm() params = None if form.validate_on_submit(): if len(form.hostname.data) == 0: abort(500) params = slib.searchmatch(form.hostname.data) sysgrps = slib.get_sysgroups() if params['hosts'] != None: for x in params['hosts']: for y in sysgrps['results']: if y['id'] == x['sysgroupid']: x['sysgroupname'] = y['name'] break else: params['hosts'] = [] return render_template('searchmatch.html', form=form, results=params)
def sysgroups(): res = slib.get_sysgroups() return render_template('sysgroups.html', results=res)