2 # Thierry Parmentelat - INRIA
5 from PLC.Faults import *
6 from PLC.Method import Method
7 from PLC.Parameter import Parameter, Mixed
8 from PLC.TagTypes import TagType, TagTypes
9 from PLC.Auth import Auth
11 can_update = lambda field_value: field_value[0] in \
12 ['tagname', 'description', 'category']
14 class AddTagType(Method):
16 Adds a new type of node tag.
17 Any fields specified are used, otherwise defaults are used.
19 Returns the new node_tag_id (> 0) if successful,
25 tag_type_fields = dict(list(filter(can_update, list(TagType.fields.items()))))
32 returns = Parameter(int, 'New node_tag_id (> 0) if successful')
35 def call(self, auth, tag_type_fields):
36 tag_type_fields = dict(list(filter(can_update, list(tag_type_fields.items()))))
37 tag_type = TagType(self.api, tag_type_fields)
40 self.object_ids = [tag_type['tag_type_id']]
42 return tag_type['tag_type_id']