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.

namerelation.py 898B

123456789101112131415161718192021222324
  1. #-*- coding: utf-8 -*-
  2. from EditorialModel import classtypes as lodelconst
  3. from . import char
  4. from .generic import FieldTypeError
  5. class EmFieldType(char.EmFieldType):
  6. help = 'Only designed to handle relation_name field value'
  7. def __init__(self, **kwargs):
  8. super().__init__(**kwargs)
  9. def check_data_consistency(self, lec, fname, datas):
  10. # We are in a context where lec is a LeRelation child class
  11. if lec.implements_lerel2type():
  12. superior = datas[lodelconst.relation_superior]
  13. if datas[fname] not in superior._linked_types.keys():
  14. return FieldTypeError("Bad relation_name for rel2type %s : '%s'" % (lec.__name__, datas[fname]))
  15. elif (datas[fname] is not None) and len(datas[fname] > 0):
  16. return FieldTypeError("No relation_name allowed for hierarchical relations")
  17. return True