1 from PLC.Faults import *
2 from PLC.Method import Method
3 from PLC.Parameter import Parameter, Mixed
4 from PLC.AddressTypes import AddressType, AddressTypes
5 from PLC.Auth import PasswordAuth
7 class AddAddressType(Method):
9 Adds a new address type. Fields specified in address_type_fields
12 Returns the new address_type_id (> 0) if successful, faults otherwise.
17 can_update = lambda (field, value): field in ['description']
18 update_fields = dict(filter(can_update, AddressType.fields.items()))
22 AddressType.fields['name'],
26 returns = Parameter(int, 'New address_type_id (> 0) if successful')
28 def call(self, auth, name, address_type_fields = {}):
29 address_type = AddressType(self.api, address_type_fields)
30 address_type['name'] = name
33 return address_type['address_type_id']