Browse Source

Issue #112: Preparing for adding node and resource filters.

- Moved plugin_name property from CLTransformer to the base class (Plugin)
main
Lakshmi Vyasarajan 13 years ago
parent
commit
24883f5f49
1 changed files with 24 additions and 24 deletions
  1. +24
    -24
      hyde/plugin.py

+ 24
- 24
hyde/plugin.py View File

@@ -94,6 +94,30 @@ class Plugin(object):


return super(Plugin, self).__getattribute__(name) 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): def begin_generation(self):
""" """
Called when generation is about to take place. 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 Handy class for plugins that simply call a command line app to
transform resources. 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 @property
def defaults(self): def defaults(self):
""" """
@@ -244,19 +257,6 @@ class CLTransformer(Plugin):
"name":self.plugin_name, "exec": self.executable_name "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 @property
def app(self): def app(self):
""" """


Loading…
Cancel
Save