暂无描述
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

12345678910111213141516171819202122
  1. # -*- coding: utf-8 -*-
  2. from lodel.editorial_model.components import EmClass
  3. from lodel.leapi.datahandlers.reference import Reference
  4. class DataHandler(Reference):
  5. ## @brief instanciates a set reference
  6. # @param allowed_classes list | None : list of allowed em classes if None no restriction
  7. # @param internal bool : if False, the field is not internal
  8. # @param kwargs : Other named arguments
  9. def __init__(self, allowed_classes = None, internal=False, **kwargs):
  10. super().__init__(allowed_classes=allowed_classes, internal=internal, **kwargs)
  11. ## @brief adds a referenced element
  12. # @param emclass EmClass
  13. # @return bool
  14. def add_ref(self, emclass):
  15. if isinstance(emclass, EmClass):
  16. self._refs.add(emclass)
  17. return True
  18. return False