Updated PositiveInteger.

This commit is contained in:
Jeremy Fincher 2004-01-19 23:45:11 +00:00
parent a8c3d67cfc
commit 9ce0e7dc7d

View File

@ -117,10 +117,12 @@ class Integer(Value):
class PositiveInteger(Value): class PositiveInteger(Value):
def set(self, s): def set(self, s):
try: try:
original = self.value
self.value = int(s) self.value = int(s)
if self.value < 0: if self.value < 0:
raise InvalidRegistryValue, 'Value must be a positive integer.' raise ValueError
except ValueError: except ValueError:
self.value = original
raise InvalidRegistryValue, 'Value must be a positive integer.' raise InvalidRegistryValue, 'Value must be a positive integer.'
class Float(Value): class Float(Value):