1 from PLC.Faults import *
2 from PLC.Method import Method
3 from PLC.Parameter import Parameter, Mixed
4 from PLC.Sites import Site, Sites
5 from PLC.Persons import Person, Persons
6 from PLC.Auth import Auth
8 class AdmGetSiteTechContacts(Method):
10 Deprecated. Functionality can be implemented with GetSites and
13 Return a list of person_ids of the technical contacts for the site
23 Mixed(Site.fields['site_id'],
24 Site.fields['login_base'])
27 returns = Site.fields['person_ids']
29 def call(self, auth, site_id_or_login_base):
30 # Authenticated function
31 assert self.caller is not None
33 # Get site information
34 sites = Sites(self.api, [site_id_or_login_base]).values()
36 raise PLCInvalidArgument, "No such site"
40 persons = Persons(self.api, site['person_ids']).values()
42 has_tech_role = lambda person: 'tech' in person['roles']
43 techs = filter(has_tech_role, persons)
45 return [tech['person_id'] for tech in techs]