Allow multiple objects to be destroyed
Enhance the destroyObject action to take an array
rather than a single path.
Change-Id: Ic1de7274afc253042b590c71ca200618a6ff54d2
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
diff --git a/pimgen.py b/pimgen.py
index 86643aa..5e2cf00 100755
--- a/pimgen.py
+++ b/pimgen.py
@@ -242,13 +242,15 @@
super(Action, self).__init__(**kw)
-class DestroyObject(Action):
+class DestroyObjects(Action):
'''Assemble a destroyObject action.'''
def __init__(self, **kw):
- args = [TrivialArgument(value=kw.pop('path'), type='string')]
+ values = [{'value': x, 'type': 'string'} for x in kw.pop('paths')]
+ args = [InitializerList(
+ values=[TrivialArgument(**x) for x in values])]
kw['args'] = args
- super(DestroyObject, self).__init__(**kw)
+ super(DestroyObjects, self).__init__(**kw)
class SetProperty(Action):
@@ -299,7 +301,7 @@
'''Assemble an inventory manager event.'''
action_map = {
- 'destroyObject': DestroyObject,
+ 'destroyObjects': DestroyObjects,
'setProperty': SetProperty,
}