UI improvements and input validations
This commit is contained in:
parent
b8c4914a52
commit
270856b391
22 changed files with 1548 additions and 302 deletions
|
|
@ -153,9 +153,13 @@ def ip_or_cidr(value, max_len=49):
|
|||
except ValueError:
|
||||
return ''
|
||||
|
||||
def mac(value, max_len=17):
|
||||
"""MAC address: hex digits and colons."""
|
||||
return _strip(value.upper(), r'[^0-9A-F:]', max_len)
|
||||
def mac(value):
|
||||
"""MAC address in aa:bb:cc:dd:ee:ff format. Colons required; no other separators accepted.
|
||||
Returns lowercase colon-separated MAC if valid, '' otherwise."""
|
||||
s = str(value).strip().lower()
|
||||
if re.fullmatch(r'([0-9a-f]{2}:){5}[0-9a-f]{2}', s):
|
||||
return s
|
||||
return ''
|
||||
|
||||
def url(value, max_len=500):
|
||||
"""URL: printable ASCII except quotes, braces, brackets, backslash, spaces."""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue