]> granicus.if.org Git - python/commitdiff
__validate(): test for None-age, not not-ness
authorBarry Warsaw <barry@python.org>
Fri, 13 Feb 1998 21:29:13 +0000 (21:29 +0000)
committerBarry Warsaw <barry@python.org>
Fri, 13 Feb 1998 21:29:13 +0000 (21:29 +0000)
Tools/pynche/TypeinViewer.py

index aabcd73a9064501580793c3dacc486ed53bf9837..d25eb827a9c77c4f35d1cd55e31d6c5412967ab1 100644 (file)
@@ -84,7 +84,7 @@ class TypeinWidget(Pmw.MegaWidget):
 
     def __validate(self, text):
        val = self.__str_to_int(text)
-       if val and val >= 0 and val < 256:
+       if (val is not None) and (val >= 0) and (val < 256):
            return 1
        else:
            return -1
@@ -96,7 +96,7 @@ class TypeinWidget(Pmw.MegaWidget):
        rgbs = map(self.__str_to_int, vals)
        valids = map(self.__validate, vals)
        delegate = self['delegate']
-       if None not in rgbs and -1 not in valids and delegate:
+       if (None not in rgbs) and (-1 not in valids) and delegate:
            delegate.set_color(self, rgbs)
 
     # called whenever the color option is changed