3 from PLC.Faults import *
4 from PLC.Method import Method
5 from PLC.Parameter import Parameter, Mixed
6 from PLC.InitScripts import InitScript, InitScripts
7 from PLC.Auth import Auth
9 can_update = lambda (field, value): field not in \
12 class AddInitScript(Method):
14 Adds a new initscript. Any fields specified in initscript_fields
15 are used, otherwise defaults are used.
17 Returns the new initscript_id (> 0) if successful, faults otherwise.
22 initscript_fields = dict(filter(can_update, InitScript.fields.items()))
29 returns = Parameter(int, 'New initscript_id (> 0) if successful')
32 def call(self, auth, initscript_fields):
33 initscript_fields = dict(filter(can_update, initscript_fields.items()))
34 initscript = InitScript(self.api, initscript_fields)
37 self.event_objects = {'InitScript': [initscript['initscript_id']]}
39 return initscript['initscript_id']