1
0
mirror of https://github.com/gryf/wicd.git synced 2026-03-11 12:05:51 +01:00

Simplify IP validation check (LP: #743795)

This commit is contained in:
David Paleino
2011-09-16 18:29:23 +02:00
parent 8f25d6caf2
commit bda00d0627

View File

@@ -144,14 +144,17 @@ def LaunchAndWait(cmd):
def IsValidIP(ip): def IsValidIP(ip):
""" Make sure an entered IP is valid. """ """ Make sure an entered IP is valid. """
if ip != None: if not ip: return False
if ip.count('.') == 3:
ipNumbers = ip.split('.') ipNumbers = ip.split('.')
if len(ipNumbers) < 4:
return False
for number in ipNumbers: for number in ipNumbers:
if not number.isdigit() or int(number) > 255: if not number.isdigit() or int(number) > 255:
return False return False
return ipNumbers return ipNumbers
return False
def PromptToStartDaemon(): def PromptToStartDaemon():
""" Prompt the user to start the daemon """ """ Prompt the user to start the daemon """