summaryrefslogtreecommitdiffstats
path: root/iw/ipwidget.py
diff options
context:
space:
mode:
authorMike Fulbright <msf@redhat.com>2002-05-31 01:40:05 +0000
committerMike Fulbright <msf@redhat.com>2002-05-31 01:40:05 +0000
commitc363bd183df627626703053d9f6052167d185262 (patch)
treed5cd9c9d6c0d9a3af19935a23ea26af8f25e5a87 /iw/ipwidget.py
parent5e07896a7836e13de3acd4b18d7ce770c70c1b5f (diff)
downloadanaconda-c363bd183df627626703053d9f6052167d185262.tar.gz
anaconda-c363bd183df627626703053d9f6052167d185262.tar.xz
anaconda-c363bd183df627626703053d9f6052167d185262.zip
added IPMissing expection if the ip entry is empty
Diffstat (limited to 'iw/ipwidget.py')
-rw-r--r--iw/ipwidget.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/iw/ipwidget.py b/iw/ipwidget.py
index 6e061c5ae..d84c3ac14 100644
--- a/iw/ipwidget.py
+++ b/iw/ipwidget.py
@@ -15,6 +15,7 @@
#
import re
+import string
import gettext
import gtk
import gobject
@@ -30,6 +31,9 @@ ip_fields = ['entry1', 'entry2', 'entry3', 'entry4']
class IPError(Exception):
pass
+class IPMissing(Exception):
+ pass
+
class IPEditor:
def __init__ (self):
self.entrys = {}
@@ -86,6 +90,16 @@ class IPEditor:
def dehydrate (self):
widget = None
+ # test if empty
+ empty = 1
+ for e in ['entry1', 'entry2', 'entry3', 'entry4']:
+ if len(string.strip(self.entrys[e].get_text())) > 0:
+ empty = 0
+ break
+
+ if empty:
+ raise IPMissing, (_("IP Address is missing"), widget)
+
try:
widget = self.entrys['entry1']
if int(widget.get_text()) > 255: