- hack xmlrpclib so that it can marshal subclasses of built-in types (e.g., Row)
[plcapi.git] / PLC / Methods / GetSites.py
1 from PLC.Method import Method
2 from PLC.Parameter import Parameter, Mixed
3 from PLC.Auth import PasswordAuth
4 from PLC.Sites import Site, Sites
5
6 class GetSites(Method):
7     """
8     Return an array of structs containing details about all sites. If
9     site_id_list is specified, only the specified sites will be
10     queried.
11     """
12
13     roles = ['admin', 'pi', 'user', 'tech']
14
15     accepts = [
16         PasswordAuth(),
17         [Mixed(Site.fields['site_id'],
18                Site.fields['login_base'])]
19         ]
20
21     returns = [Site.fields]
22
23     event_type = 'Get'
24     object_type = 'Site'
25     object_ids = []
26         
27     def call(self, auth, site_id_or_login_base_list = None):
28         return Sites(self.api, site_id_or_login_base_list).values()