option.py.patch
tiramisu/option/option.py | ||
---|---|---|
192 | 192 |
err = self._impl_valid_unicode(value) |
193 | 193 |
if err: |
194 | 194 |
return err |
195 |
if value.count('.') != 3: |
|
196 |
return ValueError(_('invalid IP')) |
|
195 | 197 |
for val in value.split('.'): |
196 | 198 |
if val.startswith("0") and len(val) > 1: |
197 | 199 |
return ValueError(_('invalid IP')) # pragma: optional cover |
... | ... | |
330 | 332 |
err = self._impl_valid_unicode(value) |
331 | 333 |
if err: |
332 | 334 |
return err |
335 |
if value.count('.') != 3: |
|
336 |
return ValueError(_('invalid network address')) |
|
337 |
for val in value.split('.'): |
|
338 |
if val.startswith("0") and len(val) > 1: |
|
339 |
return ValueError(_('invalid network address')) |
|
333 | 340 |
try: |
334 | 341 |
IP(value) |
335 | 342 |
except ValueError: # pragma: optional cover |
... | ... | |
354 | 361 |
err = self._impl_valid_unicode(value) |
355 | 362 |
if err: |
356 | 363 |
return err |
364 |
if value.count('.') != 3: |
|
365 |
return ValueError(_('invalid netmask address')) |
|
366 |
for val in value.split('.'): |
|
367 |
if val.startswith("0") and len(val) > 1: |
|
368 |
return ValueError(_('invalid netmask address')) |
|
357 | 369 |
try: |
358 | 370 |
IP('0.0.0.0/{0}'.format(value)) |
359 | 371 |
except ValueError: # pragma: optional cover |