Trees | Indices | Help |
|
---|
|
1 from advene.model.cam.consts import CAM_TYPE, CAMSYS_TYPE 2 from advene.model.cam.element import CamElementMixin 3 from advene.model.cam.exceptions import SemanticError 4 from advene.model.core.annotation import Annotation as CoreAnnotation 5 from advene.model.core.element import TAG 6836 37 Annotation.make_metadata_property(CAM_TYPE, "type", default=None, doc=""" 38 The type of this annotation, created with Package.create_annotation_type(). May be None if undefined. 39 """) 4010 if key == CAM_TYPE: 11 advene_type = getattr(value, "ADVENE_TYPE", None) 12 if advene_type: 13 if advene_type is not TAG \ 14 or value.get_meta(CAMSYS_TYPE, None) != "annotation-type": 15 raise SemanticError("not an annotation type") 16 else: 17 if not val_is_idref: 18 raise SemanticError("not an annotation type") 19 20 old_type = self.get_meta_id(key, None) 21 owner = self._owner 22 if old_type: 23 old_type = owner.get(old_type, old_type) # get element if we can 24 owner._dissociate_tag_nowarn(self, old_type) 25 owner._associate_tag_nowarn(self, value) 26 27 return super(Annotation, self).set_meta(key, value, val_is_idref)2830 if key == CAM_TYPE: 31 # TODO raise a user-warning, this is not good practice 32 old_type = self.get_meta(key, None) 33 if old_type: 34 self._owner._dissociate_tag_nowarn(self, old_type) 35 return super(Annotation, self).del_meta(key)
Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Wed Jul 8 16:00:10 2009 | http://epydoc.sourceforge.net |