From: Holger Schurig Date: Fri, 16 Apr 2010 08:59:22 +0000 (+0200) Subject: webber.py: add plugin_dirs[] configuration X-Git-Url: https://oss.titaniummirror.com/gitweb?p=webber.git;a=commitdiff_plain;h=36520f95d36d872ac58dd0df63d51756e8ff37c5 webber.py: add plugin_dirs[] configuration --- diff --git a/in/configuration.md b/in/configuration.md index ed5648f..4e785c9 100644 --- a/in/configuration.md +++ b/in/configuration.md @@ -27,6 +27,9 @@ Webber expects a `webber.conf` file in it's root directory. It should look like "read_markdown", "template_mako", ] + plugin_dirs: [ + "my_plugins" + ] exclude_dir: [ "webber.conf", "*.tmpl", @@ -65,7 +68,12 @@ Encoding ('utf-8', 'iso-8859-1' etc) used when writing the final HTML pages. == plugins == -List of [[plugins]] to load. +List of to load. + +== plugin_dirs == + +List of directories that should be search for [[plugins]]. Can be empty or +completely omitted. == exclude_dirs == diff --git a/in/plugins/index.md b/in/plugins/index.md index 176cde1..bbf30a3 100644 --- a/in/plugins/index.md +++ b/in/plugins/index.md @@ -17,10 +17,13 @@ to plugins. Those plugins do: There's another plugin there ([[skeleton.py|skeleton]]), which is is just a demo for plugin-programmers. -Plugins simply reside in the "`plugins/`" directory. However, webber -doesn't load all of them automatically. Instead you specify in the -configuration file [[webber.conf|configuration]] which -plugins you want. +Plugins simply reside in the "`plugins/`" directory from webber itself. If your +web project needs local plugins, you can specifiy additional plugins with +"`plugin_dirs`" in [[webber.conf|configuration]]. + +Note that webber doesn't load all of them automatically. Instead you specify +in the configuration file [[webber.conf|configuration]] which plugins you +want. Use the variable "`plugins`" for that. Once plugins are loaded, webber orchestrates the work of itself and all plugins via [[hooks]]. diff --git a/webber.py b/webber.py index 73f9e73..9b3d072 100644 --- a/webber.py +++ b/webber.py @@ -337,6 +337,9 @@ hooks = {} def load_plugins(): """Loads all plugins in the plugins directory.""" sys.path.append(os.path.join(get_program_directory(), "plugins")) + if cfg.has_key("plugin_dirs"): + for s in cfg.plugin_dirs: + sys.path.append(s) for s in cfg.plugins: #print "import:", s try: