Add Float conftype

This commit is contained in:
Florian Bruhin 2014-04-20 19:25:15 +02:00
parent 9152e40bfb
commit 0bbd128fca

View File

@ -164,6 +164,22 @@ class Int(BaseType):
raise ValidationError(value, "must be an integer!")
class Float(BaseType):
"""Base class for an float setting."""
typestr = 'float'
def transform(self, value):
return float(value)
def validate(self, value):
try:
float(value)
except ValueError:
raise ValidationError(value, "must be a float!")
class List(BaseType):
"""Base class for a (string-)list setting."""