comparison libervia/backend/core/main.py @ 4333:e94799a0908f

core (main): Let plugins have several handlers + various improvements: `get_handler` can now return several handlers, which is notably useful for component with several included services. Various improvements such move to `async` method, docstring/type hints update, and slight improvment of SatXMPPComponent. rel 453
author Goffi <goffi@goffi.org>
date Tue, 03 Dec 2024 00:11:00 +0100
parents 94e0968987cd
children
comparison
equal deleted inserted replaced
4332:71c939e34ca6 4333:e94799a0908f
514 log.exception(f"Can't load plugin \"{plugin_info['name']}\", ignoring it") 514 log.exception(f"Can't load plugin \"{plugin_info['name']}\", ignoring it")
515 if optional: 515 if optional:
516 return 516 return
517 raise ImportError("Error during initiation") 517 raise ImportError("Error during initiation")
518 if C.bool(plugin_info.get(C.PI_HANDLER, C.BOOL_FALSE)): 518 if C.bool(plugin_info.get(C.PI_HANDLER, C.BOOL_FALSE)):
519 self.plugins[import_name].is_handler = True 519 self.plugins[import_name].has_handlers = True
520 else: 520 else:
521 self.plugins[import_name].is_handler = False 521 self.plugins[import_name].has_handlers = False
522 # we keep metadata as a Class attribute 522 # we keep metadata as a Class attribute
523 self.plugins[import_name]._info = plugin_info 523 self.plugins[import_name]._info = plugin_info
524 # TODO: test xmppclient presence and register handler parent 524 # TODO: test xmppclient presence and register handler parent
525 525
526 def plugins_unload(self): 526 def plugins_unload(self):