def __call__(self, field_data, all_data):
        data = str(field_data)
        try:
            float(data)
        except ValueError:
            raise ValidationError, gettext("Please enter a valid decimal number.")
        # Negative floats require more space to input.
        max_allowed_length = data.startswith('-') and (self.max_digits + 2) or (self.max_digits + 1)
        if len(data) > max_allowed_length:
            raise ValidationError, ngettext("Please enter a valid decimal number with at most %s total digit.",
                "Please enter a valid decimal number with at most %s total digits.", self.max_digits) % self.max_digits
        if (not '.' in data and len(data) > (max_allowed_length - self.decimal_places - 1)) or ('.' in data and len(data) > (max_allowed_length - (self.decimal_places - len(data.split('.')[1])))):
            raise ValidationError, ngettext( "Please enter a valid decimal number with a whole part of at most %s digit.",
                "Please enter a valid decimal number with a whole part of at most %s digits.", str(self.max_digits-self.decimal_places)) % str(self.max_digits-self.decimal_places)
        if data in '.' and len(data.split('.')[1]) > self.decimal_places:
            raise ValidationError, ngettext("Please enter a valid decimal number with at most %s decimal place.",
                "Please enter a valid decimal number with at most %s decimal places.", self.decimal_places) % self.decimal_places
dataset/ETHPy150Open CollabQ/CollabQ/.google_appengine/lib/django/django/core/validators.py/IsValidFloat.__call__/swapped operands of `in`