No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

integer.py 516B

1234567891011121314151617181920
  1. # -*- coding: utf-8 -*-
  2. from ..data_field import FieldDataHandler
  3. class DataHandler(FieldDataHandler):
  4. help = 'Basic integer field'
  5. base_type = 'int'
  6. def __init__(self, **kwargs):
  7. super().__init__(base_type='int', **kwargs)
  8. def _check_data_value(self, value):
  9. error = None
  10. try:
  11. value = int(value)
  12. except(ValueError, TypeError):
  13. error = TypeError("The value '%s' is not, and will never, be an integer" % value)
  14. return value, error