Branch 5.0 for module PLCAPI created from tag PLCAPI-4.2-8
[plcapi.git] / PLC / Methods / AdmAddPerson.py
1 from PLC.Faults import *
2 from PLC.Method import Method
3 from PLC.Parameter import Parameter, Mixed
4 from PLC.Persons import Person, Persons
5 from PLC.Auth import Auth
6 from PLC.Methods.AddPerson import AddPerson
7
8 can_update = lambda (field, value): field in \
9              ['title', 'email', 'password', 'phone', 'url', 'bio']
10
11 class AdmAddPerson(AddPerson):
12     """
13     Deprecated. See AddPerson.
14     """
15
16     status = "deprecated"
17
18     person_fields = dict(filter(can_update, Person.fields.items()))
19
20     accepts = [
21         Auth(),
22         Person.fields['first_name'],
23         Person.fields['last_name'],
24         person_fields
25         ]
26
27     def call(self, auth, first_name, last_name, person_fields = {}):
28         person_fields['first_name'] = first_name
29         person_fields['last_name'] = last_name
30         return AddPerson.call(self, auth, person_fields)