From 24883f5f4904a0b3d06d705c8772a7e05fc01d64 Mon Sep 17 00:00:00 2001 From: Lakshmi Vyasarajan Date: Wed, 23 Nov 2011 07:25:04 +0530 Subject: [PATCH] Issue #112: Preparing for adding node and resource filters. - Moved plugin_name property from CLTransformer to the base class (Plugin) --- hyde/plugin.py | 48 ++++++++++++++++++++++++------------------------ 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/hyde/plugin.py b/hyde/plugin.py index e016b8a..33f8a19 100644 --- a/hyde/plugin.py +++ b/hyde/plugin.py @@ -94,6 +94,30 @@ class Plugin(object): return super(Plugin, self).__getattribute__(name) + @property + def settings(self): + """ + The settings for this plugin the site config. + """ + + opts = Expando({}) + try: + opts = getattr(self.site.config, self.plugin_name) + except AttributeError: + pass + return opts + + + @property + def plugin_name(self): + """ + The name of the plugin. Makes an intelligent guess. + + This is used to lookup the settings for the plugin. + """ + + return self.__class__.__name__.replace('Plugin', '').lower() + def begin_generation(self): """ Called when generation is about to take place. @@ -201,17 +225,6 @@ class CLTransformer(Plugin): Handy class for plugins that simply call a command line app to transform resources. """ - - @property - def plugin_name(self): - """ - The name of the plugin. Makes an intelligent guess. - - This is used to lookup the settings for the plugin. - """ - - return self.__class__.__name__.replace('Plugin', '').lower() - @property def defaults(self): """ @@ -244,19 +257,6 @@ class CLTransformer(Plugin): "name":self.plugin_name, "exec": self.executable_name }) - @property - def settings(self): - """ - The settings for this plugin the site config. - """ - - opts = Expando({}) - try: - opts = getattr(self.site.config, self.plugin_name) - except AttributeError: - pass - return opts - @property def app(self): """