1 from PLC.Faults import *
2 from PLC.Method import Method
3 from PLC.Parameter import Parameter, Mixed
4 from PLC.PCUTypes import PCUType, PCUTypes
5 from PLC.Auth import Auth
7 can_update = lambda (field, value): field in \
10 class AddPCUType(Method):
14 Returns the new pcu_type_id (> 0) if successful, faults otherwise.
19 pcu_type_fields = dict(filter(can_update, PCUType.fields.items()))
26 returns = Parameter(int, 'New pcu_type_id (> 0) if successful')
29 def call(self, auth, pcu_type_fields):
30 pcu_type_fields = dict(filter(can_update, pcu_type_fields.items()))
31 pcu_type = PCUType(self.api, pcu_type_fields)
33 self.event_object = {'PCUType': [pcu_type['pcu_type_id']]}
35 return pcu_type['pcu_type_id']