X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=PLC%2FMethods%2FAddAddressType.py;h=284771412ef0ef5f84ee6553f9c8d61dde28ee09;hb=bd0cbf4f7f2e4cf7ceda500bfa6f98c0a700018b;hp=904a432babf97fdd152bdc64c8a69a6760feaa65;hpb=7e7751b60ad5379a11bb78e571bad3df9f5eb02f;p=plcapi.git diff --git a/PLC/Methods/AddAddressType.py b/PLC/Methods/AddAddressType.py index 904a432..2847714 100644 --- a/PLC/Methods/AddAddressType.py +++ b/PLC/Methods/AddAddressType.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 not in ['address_type_id'] @@ -19,21 +19,18 @@ class AddAddressType(Method): address_type_fields = dict(filter(can_update, AddressType.fields.items())) accepts = [ - PasswordAuth(), + Auth(), address_type_fields ] returns = Parameter(int, 'New address_type_id (> 0) if successful') - - event_type = 'Add' - object_type = 'AddressType' - object_ids = [] + def call(self, auth, address_type_fields): address_type_fields = dict(filter(can_update, address_type_fields.items())) address_type = AddressType(self.api, address_type_fields) address_type.sync() - self.object_ids = [address_type['address_type_id']] - - return address_type['address_type_id'] + self.event_objects = {'AddressType' : [address_type['address_type_id']]} + + return address_type['address_type_id']