暫無描述
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 531B

123456789101112131415161718192021
  1. #-*- coding: utf-8 -*-
  2. from .generic import SingleValueFieldType
  3. class EmFieldType(SingleValueFieldType):
  4. help = 'Basic integer field'
  5. ftype = 'int'
  6. def __init__(self, **kwargs):
  7. super(EmFieldType, self).__init__(ftype='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)