change config structure
This commit is contained in:
@@ -331,18 +331,17 @@ class Notify:
|
||||
def __init__(self, cfg, local_addrs, debug):
|
||||
self.cfg = cfg
|
||||
self.logger = logging.getLogger(cfg["name"])
|
||||
del cfg["name"]
|
||||
self.logger.setLevel(cfg.get_loglevel(debug))
|
||||
|
||||
nodification_type = cfg["options"]["type"]
|
||||
del cfg["options"]["type"]
|
||||
cfg["options"]["pretend"] = cfg["pretend"]
|
||||
self._notification = self.NOTIFICATION_TYPES[nodification_type](
|
||||
**cfg["options"])
|
||||
del cfg["loglevel"]
|
||||
nodification_type = cfg["type"]
|
||||
del cfg["type"]
|
||||
self._notification = self.NOTIFICATION_TYPES[nodification_type](**cfg)
|
||||
self._headersonly = self._notification._headersonly
|
||||
|
||||
def __str__(self):
|
||||
cfg = []
|
||||
for key, value in self.cfg["options"].items():
|
||||
for key, value in self.cfg.items():
|
||||
cfg.append(f"{key}={value}")
|
||||
class_name = type(self._notification).__name__
|
||||
return f"{class_name}(" + ", ".join(cfg) + ")"
|
||||
|
||||
Reference in New Issue
Block a user