def isNonEmptyFile(self, new_data, all_data):
     if hasattr(new_data, 'upload_errors'):
         upload_errors = new_data.upload_errors()
         if upload_errors:
             raise validators.CriticalValidationError(upload_errors)
     try:
         file_size = new_data.size
     except AttributeError:
         file_size = len(new_data['content'])
     if not file_size:
         raise validators.CriticalValidationError(ugettext("The submitted file is empty."))
 def isValidPhone(self, field_data, all_data):
     try:
         validators.isValidPhone(field_data, all_data)
     except validators.ValidationError as e:
         raise validators.CriticalValidationError(e.messages)
 def isValidDecimal(self, field_data, all_data):
     v = validators.IsValidDecimal(self.max_digits, self.decimal_places)
     try:
         v(field_data, all_data)
     except validators.ValidationError as e:
         raise validators.CriticalValidationError(e.messages)
 def isPositiveSmall(self, field_data, all_data):
     if not 0 <= int(field_data) <= 32767:
         raise validators.CriticalValidationError(ugettext("Enter a whole number between 0 and 32,767."))
 def isPositive(self, field_data, all_data):
     if int(field_data) < 0:
         raise validators.CriticalValidationError(ugettext("Enter a positive number."))
 def isSmallInteger(self, field_data, all_data):
     if not -32768 <= int(field_data) <= 32767:
         raise validators.CriticalValidationError(ugettext("Enter a whole number between -32,768 and 32,767."))
 def isValidXML(self, field_data, all_data):
     v = validators.RelaxNGCompact(self.schema_path)
     try:
         v(field_data, all_data)
     except validators.ValidationError as e:
         raise validators.CriticalValidationError(e.messages)
 def isCommaSeparatedIntegerList(self, field_data, all_data):
     try:
         validators.isCommaSeparatedIntegerList(field_data, all_data)
     except validators.ValidationError as e:
         raise validators.CriticalValidationError(e.messages)