2 # Thierry Parmentelat - INRIA
8 from PLC.Faults import *
9 from PLC.Method import Method
10 from PLC.Parameter import Parameter, Mixed
11 from PLC.NodeTagTypes import NodeTagType, NodeTagTypes
12 from PLC.Auth import Auth
14 can_update = lambda (field, value): field in \
15 ['name', 'description', 'category', 'min_role_id']
17 class AddNodeTagType(Method):
19 Adds a new type of node tag.
20 Any fields specified are used, otherwise defaults are used.
22 Returns the new node_tag_id (> 0) if successful,
28 node_tag_type_fields = dict(filter(can_update, NodeTagType.fields.items()))
35 returns = Parameter(int, 'New node_tag_id (> 0) if successful')
38 def call(self, auth, node_tag_type_fields):
39 node_tag_type_fields = dict(filter(can_update, node_tag_type_fields.items()))
40 node_tag_type = NodeTagType(self.api, node_tag_type_fields)
43 self.object_ids = [node_tag_type['node_tag_type_id']]
45 return node_tag_type['node_tag_type_id']