Accept either : or - as mac separator
This commit is contained in:
parent
19a3a7f64b
commit
591080c395
1 changed files with 2 additions and 2 deletions
4
main.py
4
main.py
|
@ -219,7 +219,7 @@ def list_users():
|
||||||
lines = render_users_tree(tree)
|
lines = render_users_tree(tree)
|
||||||
return render_template("users.html", users=lines)
|
return render_template("users.html", users=lines)
|
||||||
|
|
||||||
mac_re = re.compile("(?:[0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2}")
|
mac_re = re.compile("(?:[0-9a-fA-F]{2}[:-]){5}[0-9a-fA-F]{2}")
|
||||||
ip_re_str = "\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}"
|
ip_re_str = "\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}"
|
||||||
ip_re = re.compile(ip_re_str)
|
ip_re = re.compile(ip_re_str)
|
||||||
DhcpHostLine = namedtuple("DhcpHostLine","macs ip tag")
|
DhcpHostLine = namedtuple("DhcpHostLine","macs ip tag")
|
||||||
|
@ -324,7 +324,7 @@ def parse_macs(macs):
|
||||||
p = p.strip()
|
p = p.strip()
|
||||||
m = mac_re.match(p)
|
m = mac_re.match(p)
|
||||||
if m:
|
if m:
|
||||||
r.append(m.group(0))
|
r.append(m.group(0).replace("-",":"))
|
||||||
return r
|
return r
|
||||||
|
|
||||||
def rename(src, dst):
|
def rename(src, dst):
|
||||||
|
|
Loading…
Reference in a new issue