X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=PLC%2FMethods%2FUpdateAddressType.py;h=8dd915978f58f6e2a68fe10e58d993309b188ab1;hb=2b8aadbf673abb2cd3ac27ef0d2e3037f6f0779b;hp=2956680035aeaaab831dcc38244a5aff6c985e56;hpb=7e7751b60ad5379a11bb78e571bad3df9f5eb02f;p=plcapi.git diff --git a/PLC/Methods/UpdateAddressType.py b/PLC/Methods/UpdateAddressType.py index 2956680..8dd9159 100644 --- a/PLC/Methods/UpdateAddressType.py +++ b/PLC/Methods/UpdateAddressType.py @@ -2,7 +2,7 @@ from PLC.Faults import * from PLC.Method import Method from PLC.Parameter import Parameter, Mixed from PLC.AddressTypes import AddressType, AddressTypes -from PLC.Auth import PasswordAuth +from PLC.Auth import Auth can_update = lambda (field, value): field in ['name', 'description'] @@ -19,7 +19,7 @@ class UpdateAddressType(Method): address_type_fields = dict(filter(can_update, AddressType.fields.items())) accepts = [ - PasswordAuth(), + Auth(), Mixed(AddressType.fields['address_type_id'], AddressType.fields['name']), address_type_fields @@ -30,12 +30,13 @@ class UpdateAddressType(Method): def call(self, auth, address_type_id_or_name, address_type_fields): address_type_fields = dict(filter(can_update, address_type_fields.items())) - address_types = AddressTypes(self.api, [address_type_id_or_name]).values() + address_types = AddressTypes(self.api, [address_type_id_or_name]) if not address_types: raise PLCInvalidArgument, "No such address type" address_type = address_types[0] address_type.update(address_type_fields) address_type.sync() + self.object_ids = [address_type['address_type_id']] return 1