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 515B

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