3 from PLC.Faults import *
4 from PLC.Method import Method
5 from PLC.Parameter import Parameter, Mixed
6 from PLC.PCUTypes import PCUType, PCUTypes
7 from PLC.Auth import Auth
9 can_update = lambda (field, value): field in \
12 class AddPCUType(Method):
16 Returns the new pcu_type_id (> 0) if successful, faults otherwise.
21 pcu_type_fields = dict(filter(can_update, PCUType.fields.items()))
28 returns = Parameter(int, 'New pcu_type_id (> 0) if successful')
31 def call(self, auth, pcu_type_fields):
32 pcu_type_fields = dict(filter(can_update, pcu_type_fields.items()))
33 pcu_type = PCUType(self.api, pcu_type_fields)
35 self.event_object = {'PCUType': [pcu_type['pcu_type_id']]}
37 return pcu_type['pcu_type_id']