diff options
author | Russell Cohen <rcoh@mit.edu> | 2011-01-20 14:57:43 -0500 |
---|---|---|
committer | Russell Cohen <rcoh@mit.edu> | 2011-01-20 14:57:43 -0500 |
commit | f45b5e262c394cf00ef88f7fca1eab1b4de0fec9 (patch) | |
tree | 0f513d55c859773e27f1f615f3160ef1f66124ce /behaviors/ModifyParam.py | |
parent | 0af38d1882291523d0d290a638e88be793f27678 (diff) |
Rewrite of Behavior parent class to suck less. Lots of bug fixes. Added
'RestrictLocation' which allows events to fire based on their location.
Diffstat (limited to 'behaviors/ModifyParam.py')
-rw-r--r-- | behaviors/ModifyParam.py | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/behaviors/ModifyParam.py b/behaviors/ModifyParam.py index 3701013..f589e05 100644 --- a/behaviors/ModifyParam.py +++ b/behaviors/ModifyParam.py @@ -5,7 +5,7 @@ class ModifyParam(Behavior): def processResponse(self, sensorInputs, recursiveInputs): paramType = self['ParamType'] paramName = self['ParamName'] - paramOp = self['ParamOp'] + paramOp = str(self['ParamOp']) if paramType == 'Sensor': searchSet = sensorInputs elif paramType == 'Recurse': @@ -13,12 +13,10 @@ class ModifyParam(Behavior): else: raise Exception('Unknown Param Type') for behaviorInput in searchSet: - if paramName in behaviorInput: - try: + if paramName in behaviorInput: #TODO: copy -> modify instead of just + #copying paramOp = paramOp.replace('{val}', 'behaviorInput[paramName]') #convert the {val} marker to something we can execute behaviorInput[paramName] = eval(paramOp) - except: - raise Exception('Bad operation. Use things like \'{val}*5\', \'{val}+5\', exp({val}) etc.') if paramType == 'Sensor': #return accordingly return (searchSet, recursiveInputs) if paramType == 'Recurse': |