3 # Thierry Parmentelat - INRIA
8 from PLC.Faults import *
9 from PLC.Method import Method
10 from PLC.Parameter import Parameter, Mixed
11 from PLC.Auth import Auth
13 from PLC.Ilinks import Ilink, Ilinks
14 from PLC.Interfaces import Interface, Interfaces
16 from PLC.Sites import Sites
18 class UpdateIlink(Method):
20 Updates the value of an existing ilink
22 Access rights depend on the tag type.
24 Returns 1 if successful, faults otherwise.
27 roles = ['admin', 'pi', 'tech', 'user']
31 Ilink.fields['ilink_id'],
35 returns = Parameter(int, '1 if successful')
37 object_type = 'Interface'
39 def call(self, auth, ilink_id, value):
40 ilinks = Ilinks(self.api, [ilink_id])
42 raise PLCInvalidArgument, "No such ilink %r"%ilink_id
45 # xxx see AddIlink for this - should be written once in the Ilink class I guess
46 # checks rights and stuff
48 ilink['value'] = value
51 self.object_ids = [ilink['src_interface_id'],ilink['dst_interface_id']]