def filter_logs(): print(Log.serialize()) logs = [log for log in Log.serialize() if all( # if the node-regex property is not in the request, the # regex box is unticked and we only check that the values # are equal. str(val) == request.form[prop] if not prop + 'regex' in request.form # if it is ticked, we use re.search to check that the value # of the node property matches the regular expression, # providing that the property field in the form is not empty # (empty field <==> property ignored) else search(request.form[prop], str(val)) for prop, val in log.items() if prop in request.form and request.form[prop] )] return jsonify(logs)
def log_management(): log_filtering_form = LogFilteringForm(request.form) return render_template('log_management.html', log_filtering_form=log_filtering_form, names=pretty_names, fields=('source', 'content'), logs=Log.serialize())
def logs(): form = LogFilteringForm(request.form) return render_template( 'logs_overview.html', form=form, names=pretty_names, fields=('source', 'content'), logs=Log.serialize(), )