From 28cd45ed6d47af5cdb20d36861e1be274ccf5a71 Mon Sep 17 00:00:00 2001 From: Tchekda Date: Sun, 9 Feb 2020 10:09:33 +0000 Subject: [PATCH] Fixed COMBINED_UNWANTED_NAMES empty issue --- lg.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lg.py b/lg.py index f37f0d0..d798f94 100644 --- a/lg.py +++ b/lg.py @@ -235,11 +235,12 @@ def whois(): SUMMARY_UNWANTED_PROTOS = ["Kernel", "Static", "Device", "BFD", "Direct", "RPKI"] # Array of regular expressions to match against protocol names, # and filter them from the summary view -SUMMARY_UNWANTED_NAMES = [ ] - -# combine the unwanted names to a single regex -COMBINED_UNWANTED_NAMES = '(?:%s)' % '|'.join(SUMMARY_UNWANTED_NAMES) +SUMMARY_UNWANTED_NAMES = [] +COMBINED_UNWANTED_NAMES = None +if len(SUMMARY_UNWANTED_NAMES) > 0 : # If regex list is not empty + # combine the unwanted names to a single regex + COMBINED_UNWANTED_NAMES = '(?:%s)' % '|'.join(SUMMARY_UNWANTED_NAMES) @app.route("/summary/") @app.route("/summary//") @@ -272,7 +273,7 @@ def summary(hosts, proto="ipv4"): if ( len(split) >= 5 and split[1] not in SUMMARY_UNWANTED_PROTOS and - not re.match(COMBINED_UNWANTED_NAMES, split[0]) + (COMBINED_UNWANTED_NAMES is None or not re.match(COMBINED_UNWANTED_NAMES, split[0])) # If the list is empty or doesn't match the protocol name ): props = dict() props["name"] = split[0]