4 # Thierry Parmentelat - INRIA
10 from PLC.Faults import *
11 from PLC.Method import Method
12 from PLC.Parameter import Parameter, Mixed
13 from PLC.TagTypes import TagType, TagTypes
14 from PLC.Auth import Auth
16 can_update = lambda (field, value): field in \
17 ['tagname', 'description', 'category', 'min_role_id']
19 class AddTagType(Method):
21 Adds a new type of node tag.
22 Any fields specified are used, otherwise defaults are used.
24 Returns the new node_tag_id (> 0) if successful,
30 tag_type_fields = dict(filter(can_update, TagType.fields.items()))
37 returns = Parameter(int, 'New node_tag_id (> 0) if successful')
40 def call(self, auth, tag_type_fields):
41 tag_type_fields = dict(filter(can_update, tag_type_fields.items()))
42 tag_type = TagType(self.api, tag_type_fields)
45 self.object_ids = [tag_type['tag_type_id']]
47 return tag_type['tag_type_id']