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