2 # Thierry Parmentelat - INRIA
5 from PLC.Method import Method
6 from PLC.Parameter import Parameter, Mixed
7 from PLC.Auth import Auth
8 from PLC.Peers import Peer, Peers
10 can_update = lambda (field, value): field in \
11 ['peername', 'peer_url', 'key', 'cacert']
13 class AddPeer(Method):
17 Returns the new peer_id (> 0) if successful, faults otherwise.
22 peer_fields = dict(filter(can_update, Peer.fields.items()))
29 returns = Parameter(int, "New peer_id (> 0) if successful")
31 def call(self, auth, peer_fields):
32 peer = Peer(self.api, peer_fields);
34 return peer['peer_id']