1 from PLC.Faults import *
2 from PLC.Method import Method
3 from PLC.Parameter import Parameter, Mixed
4 from PLC.Auth import Auth
6 from PLC.Peers import Peer, Peers
8 can_update = lambda(k,v): k in ['peername','peer_url','person_id']
10 class AddPeer (Method):
12 Creates a peer entry in the database and returns its id
13 Temporarily, requires to provide a person_id
14 this is used to store the credentials that we'll
15 use when connecting to the peer's API
19 peer_fields = dict( [x for x in Peer.fields.iteritems() if can_update(x)] )
25 returns = Parameter (int, "peer_id")
27 def call (self, auth, fields):
29 peer = Peer (self.api,fields);
32 return peer['peer_id']