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.

pk.py 751B

1234567891011121314151617181920212223242526
  1. #-*- coding: utf-8 -*-
  2. from . import integer
  3. ## @todo This EmFieldType is a bit dirty....
  4. class EmFieldType(integer.EmFieldType):
  5. help = 'Integer primary key fieldtype'
  6. def __init__(self, **kwargs):
  7. # Allowed argument => value for this EmFieldType
  8. allowed = {
  9. 'nullable': False,
  10. 'uniq': False,
  11. 'internal': 'autosql',
  12. 'primary': True,
  13. }
  14. # Checking args
  15. for name, value in kwargs.items():
  16. if name in allowed and value != allowed[name]:
  17. raise ValueError("The value '%s' for argument '%s' for pk EmFieldType is not allowed" % (value, name))
  18. kwargs.update(allowed)
  19. super(EmFieldType, self).__init__(**kwargs)