Replaced .title in get_plugin with .upper on the first character.

`str.title` capitalizes any alphabetic letter after any non-alphabetic
letter. That's a problem for Platypush plugins' naming convention,
because plugins like `sensor.distance.vl53l1x` may be broken into
`sensor.distance.vl53.l1.x`.
This commit is contained in:
Fabio Manganiello 2023-03-31 14:09:43 +02:00
parent c2f9ebf4ed
commit e198f2a175

View file

@ -148,7 +148,8 @@ def get_plugin(plugin, plugin_name=None, reload=False):
# e.g. plugins.music.mpd main class: MusicMpdPlugin # e.g. plugins.music.mpd main class: MusicMpdPlugin
cls_name = '' cls_name = ''
for token in name.split('.'): for token in name.split('.'):
cls_name += token.title() if token:
cls_name += token[0].upper() + token[1:]
cls_name += 'Plugin' cls_name += 'Plugin'
plugin_conf = Config.get_plugins()[name] if name in Config.get_plugins() else {} plugin_conf = Config.get_plugins()[name] if name in Config.get_plugins() else {}