make example CIDR form address family appropriate

https://bugs.launchpad.net/bugs/1782391
This commit is contained in:
Michael Hudson-Doyle 2018-07-23 10:38:06 +12:00
parent 7f766e93a1
commit 96ee3db409
1 changed files with 5 additions and 1 deletions

View File

@ -92,7 +92,11 @@ class NetworkConfigForm(Form):
def clean_subnet(self, subnet):
log.debug("clean_subnet %r", subnet)
if '/' not in subnet:
raise ValueError(_("should be in CIDR form (xx.xx.xx.xx/yy)"))
if self.ip_version == 4:
example = "xx.xx.xx.xx/yy"
else:
example = "xx:xx:..:xx/yy"
raise ValueError(_("should be in CIDR form ({})").format(example))
return self.ip_network_cls(subnet)
def clean_address(self, address):