def convert(self, value):
        value = _to_string(value)
        if not value:
            if self.required:
                message = self.messages['required']
                if message is None:
                    message = self.gettext(u'This field is required.')
                raise ValidationError(message)
            return None
        try:
            value = float(value)
        except __HOLE__:
            message = self.messages['no_float']
            if message is None:
                message = self.gettext('Please enter a floating-point number.')
            raise ValidationError(message)

        if self.min_value is not None and value < self.min_value:
            message = self.messages['too_small']
            if message is None:
                message = self.gettext(u'Ensure this value is greater than or '
                                       u'equal to %s.') % self.min_value
            raise ValidationError(message)
        if self.max_value is not None and value > self.max_value:
            message = self.messages['too_big']
            if message is None:
                message = self.gettext(u'Ensure this value is less than or '
                                       u'equal to %s.') % self.max_value
            raise ValidationError(message)

        return float(value)
dataset/ETHPy150Open mitsuhiko/fungiform/fungiform/forms.py/FloatField.convert