forked from platypush/platypush
Made variable.set less verbose and more flexible. Replace the syntax like {"action":"variable.set", "args": {"name":"foo", "value":"bar"}} with a more compact {"action":"variable.set", "args":{"foo":"bar"}}
This commit is contained in:
parent
9113ac0530
commit
f9c0d83f79
1 changed files with 4 additions and 3 deletions
|
@ -15,9 +15,10 @@ class VariablePlugin(Plugin):
|
|||
def get(self, name, default_value=None):
|
||||
return Response(output={name: self._variables.get(name, default_value)})
|
||||
|
||||
def set(self, name, value):
|
||||
self._variables[name] = value
|
||||
return Response(output={name: value})
|
||||
def set(self, **kwargs):
|
||||
for (name, value) in kwargs.items():
|
||||
self._variables[name] = value
|
||||
return Response(output=kwargs)
|
||||
|
||||
def unset(self, name):
|
||||
if name in self._variables:
|
||||
|
|
Loading…
Reference in a new issue