2 # Thierry Parmentelat - INRIA
7 from PLC.Faults import *
8 from PLC.Method import Method
9 from PLC.Parameter import Parameter, Mixed
10 from PLC.Auth import Auth
12 from PLC.Ilinks import Ilink, Ilinks
13 from PLC.Interfaces import Interface, Interfaces
15 from PLC.Sites import Sites
17 class UpdateIlink(Method):
19 Updates the value of an existing ilink
21 Access rights depend on the tag type.
23 Returns 1 if successful, faults otherwise.
26 roles = ['admin', 'pi', 'tech', 'user']
30 Ilink.fields['ilink_id'],
34 returns = Parameter(int, '1 if successful')
36 object_type = 'Interface'
38 def call(self, auth, ilink_id, value):
39 ilinks = Ilinks(self.api, [ilink_id])
41 raise PLCInvalidArgument, "No such ilink %r"%ilink_id
44 # xxx see AddIlink for this - should be written once in the Ilink class I guess
45 # checks rights and stuff
47 ilink['value'] = value
50 self.object_ids = [ilink['src_interface_id'],ilink['dst_interface_id']]