From: Mark Huang Date: Tue, 17 Oct 2006 04:24:57 +0000 (+0000) Subject: - no need to specify site_id X-Git-Tag: pycurl-7_13_1~547 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=88fb75528cb840d3c339ffbce65252333a941961;p=plcapi.git - no need to specify site_id --- diff --git a/PLC/Methods/GetAddresses.py b/PLC/Methods/GetAddresses.py index a558f540..b5240a59 100644 --- a/PLC/Methods/GetAddresses.py +++ b/PLC/Methods/GetAddresses.py @@ -2,43 +2,28 @@ from PLC.Faults import * from PLC.Method import Method from PLC.Parameter import Parameter, Mixed from PLC.Addresses import Address, Addresses -from PLC.Sites import Site, Sites from PLC.Auth import PasswordAuth class GetAddresses(Method): """ - Get an array of structs containing the addresses of the specified - site. If address_id_list is specified, only the specified - addresses will be queried. + Get an array of structs containing details about addresses. If + address_id_list is specified, only the specified addresses will be + queried. """ roles = ['admin', 'pi', 'user', 'tech'] accepts = [ PasswordAuth(), - Mixed(Site.fields['site_id'], - Site.fields['login_base']), [Address.fields['address_id']], ] returns = [Address.fields] - def call(self, auth, site_id_or_login_base, address_id_list = None): - sites = Sites(self.api, [site_id_or_login_base]).values() - if not sites: - raise PLCInvalidArgument, "No such site" - site = sites[0] - - if address_id_list is None: - address_id_list = site['address_ids'] - else: - if set(address_id_list).intersection(site['address_ids']) != \ - set(address_id_list): - raise PLCInvalidArgument, "Invalid address ID(s)" - + def call(self, auth, address_id_list = None): addresses = Addresses(self.api, address_id_list).values() # Turn each address into a real dict - addresses = [dict(address.items) for address in addresses] + addresses = [dict(address) for address in addresses] return addresses