From 8419152668c6af886bd7c64eb55ca1bd8ccb5eb4 Mon Sep 17 00:00:00 2001 From: Mehdi Abaakouk Date: Tue, 16 Oct 2012 08:07:30 +0200 Subject: [PATCH] Fix issue #2 --- lg.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lg.py b/lg.py index c9695cb..86f0804 100755 --- a/lg.py +++ b/lg.py @@ -63,7 +63,10 @@ def add_links(text): line = re.sub(r'([a-zA-Z0-9\-]*\.([a-zA-Z]{2,3}){1,2})(\s|$)', r'\1\3', line) line = re.sub(r'AS(\d+)', r'AS\1', line) line = re.sub(r'(\d+\.\d+\.\d+\.\d+)', r'\1', line) - hosts = "/".join(request.path.split("/")[2:]) + if len(request.path) >= 2: + hosts = "/".join(request.path.split("/")[2:]) + else: + hosts = "/" line = re.sub(r'\[(\w+)\s+((|\d\d\d\d-\d\d-\d\d\s)(|\d\d:)\d\d:\d\d|\w\w\w\d\d)', r'[\1 \2' % hosts, line) line = re.sub(r'(^|\s+)(([a-f\d]{0,4}:){3,10}[a-f\d]{0,4})', r'\1\2', line, re.I) ret_text.append(line) @@ -535,7 +538,7 @@ def show_route(request_type, hosts, proto): command = "show route where net ~ [ " + expression + " ]" + all else: mask = "" - if len(expression.split("/")) > 1: + if len(expression.split("/")) == 2: expression, mask = (expression.split("/")) if not mask and proto == "ipv4":