Skip to content
Snippets Groups Projects
Commit fe3a98ff authored by Wouter Deconinck's avatar Wouter Deconinck Committed by MarkusFrankATcernch
Browse files

fix: accept list of str as action argument

parent fd757899
No related branches found
No related tags found
No related merge requests found
...@@ -160,8 +160,15 @@ or ...@@ -160,8 +160,15 @@ or
# creates: [ { "name": "Geant4TestEventAction", "parameter": {"Property_int": 10} } ] # creates: [ { "name": "Geant4TestEventAction", "parameter": {"Property_int": 10} } ]
val = [val] val = [val]
if isinstance(val, list): if isinstance(val, list):
# assumes: [ { "name": "Geant4TestEventAction", "parameter": {"Property_int": 10} } ] if not val:
return val # empty list
return []
if isinstance(val[0], str):
# assumes: [ "Geant4TestEventAction", "Geant4TestEventAction" ]
return [dict(name=v) for v in val]
if isinstance(val[0], dict):
# assumes: [ { "name": "Geant4TestEventAction", "parameter": {"Property_int": 10} } ]
return val
raise RuntimeError("Commandline setting of action is not successful for: %s " % val) raise RuntimeError("Commandline setting of action is not successful for: %s " % val)
@property @property
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment