Package qanda :: Module validators :: Class ToFloat
[hide private]
[frames] | no frames]

Class ToFloat

source code

   object --+    
            |    
BaseValidator --+
                |
               ToFloat

Convert a value to a float.

While you could just use float, this throws a much nicer error message.

Instance Methods [hide private]
 
convert(self, value)
Transform this value to the desired form.
source code

Inherited from BaseValidator: __call__, validate

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __init__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

convert(self, value)

source code 

Transform this value to the desired form.

Can throw if conversion fails. Override in subclass if required.

Parameters:
  • value - value to be transformed
Returns:
the transformed value
Overrides: BaseValidator.convert
(inherited documentation)