Commit 4d7044d2 by Owo Sugiana

read_conf.py tidak lagi mewajibkan modul punya init()

1 parent 0e84e6a6
0.1.5 2020-04-28
----------------
- read_conf.py tidak lagi mewajibkan setiap modul punya init()
0.1.4 2020-04-22 0.1.4 2020-04-22
---------------- ----------------
- Parser.run() mencatat kesalahan tak terduga - Parser.run() mencatat kesalahan tak terduga
......
...@@ -123,7 +123,11 @@ def read_conf(conf_file): ...@@ -123,7 +123,11 @@ def read_conf(conf_file):
if conf.has_section(module_section): if conf.has_section(module_section):
for key in conf.options(module_section): for key in conf.options(module_section):
cfg[key] = conf.get(module_section, key) cfg[key] = conf.get(module_section, key)
cfg['module_obj'].init(cfg) try:
f_init = getattr(cfg['module_obj'], 'init')
f_init(cfg)
except AttributeError:
pass
append_others(cfg, conf, section) append_others(cfg, conf, section)
if cfg['listen']: if cfg['listen']:
if port not in listen_ports: if port not in listen_ports:
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!