Skip to content

Commit cc866bf

Browse files
committed
#75: add new parameter as_json for plugin_config() helper.
1 parent 10fd4ae commit cc866bf

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

mamonsu/lib/plugin.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import logging
55
import traceback
66
import sys
7+
import json
78

89
from threading import Thread
910

@@ -78,10 +79,13 @@ def set_default_config(cls, config):
7879
config.set(name, x, '{0}'.format(cls.DEFAULT_CONFIG[x]))
7980

8081
# get value from config
81-
def plugin_config(self, name):
82+
def plugin_config(self, name, as_json=False):
8283
if name not in self._plugin_config:
8384
return None
84-
return self._plugin_config[name]
85+
if as_json:
86+
return json.loads(self._plugin_config[name])
87+
else:
88+
return self._plugin_config[name]
8589

8690
def start(self):
8791
self._thread = Thread(target=self._loop)

0 commit comments

Comments
 (0)