adding a new util method for setting options

This commit is contained in:
Hossein Shafagh 2019-04-11 16:38:00 -07:00
parent 557fac39b5
commit d7abf2ec18
1 changed files with 11 additions and 1 deletions

View File

@ -18,4 +18,14 @@ def get_plugin_option(name, options):
""" """
for o in options: for o in options:
if o.get('name') == name: if o.get('name') == name:
return o['value'] return o.get('value', o.get('default'))
def set_plugin_option(name, value, options):
"""
Set value for option name for options dict.
:param options:
"""
for o in options:
if o.get('name') == name:
o.update({'value': value})