From 0ed8afd999004d34a0575b11fed38961e4dd4c52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Wed, 1 Apr 2015 11:54:11 +0200 Subject: [PATCH] Fix: Validate plugins separately from constructor Otherwise plugins that inject data via __plugin_init__ won't work properly --- src/octoprint/plugin/core.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/octoprint/plugin/core.py b/src/octoprint/plugin/core.py index c98a58db..109db26c 100644 --- a/src/octoprint/plugin/core.py +++ b/src/octoprint/plugin/core.py @@ -109,9 +109,7 @@ class PluginInfo(object): self._url = url self._license = license - self._validate() - - def _validate(self): + def validate(self): # if the plugin still uses __plugin_implementations__, log a deprecation warning and put the first # item into __plugin_implementation__ if hasattr(self.instance, self.__class__.attr_implementations): @@ -484,6 +482,9 @@ class PluginManager(object): # initialize the plugin plugin.init() + # validate the plugin + plugin.validate() + # evaluate registered hooks for hook, callback in plugin.hooks.items(): self.plugin_hooks[hook].append((name, callback))