[Issue 466] Implement e-z plugin disabling
This commit is contained in:
parent
05e007c1db
commit
05d8f314c6
@ -135,3 +135,35 @@ For plugins that you install with pip, you can upgrade them with pip::
|
|||||||
pip install -U <plugin-name>
|
pip install -U <plugin-name>
|
||||||
|
|
||||||
The ``-U`` tells pip to upgrade the package.
|
The ``-U`` tells pip to upgrade the package.
|
||||||
|
|
||||||
|
|
||||||
|
Troubleshooting plugins
|
||||||
|
=======================
|
||||||
|
|
||||||
|
Sometimes plugins just don't work right. When you're having problems
|
||||||
|
with plugins, think about the following:
|
||||||
|
|
||||||
|
1. Check the log files.
|
||||||
|
|
||||||
|
Some plugins will log errors to the log files and you can use that
|
||||||
|
to diagnose the problem.
|
||||||
|
|
||||||
|
2. Try running MediaGoblin without that plugin.
|
||||||
|
|
||||||
|
It's easy to disable a plugin from MediaGoblin. Add a ``-`` to the
|
||||||
|
name in your config file.
|
||||||
|
|
||||||
|
For example, change::
|
||||||
|
|
||||||
|
[[mediagoblin.plugins.flatpages]]
|
||||||
|
|
||||||
|
to::
|
||||||
|
|
||||||
|
[[-mediagoblin.plugins.flatpages]]
|
||||||
|
|
||||||
|
That'll prevent the ``mediagoblin.plugins.flatpages`` plugin from
|
||||||
|
loading.
|
||||||
|
|
||||||
|
3. If it's a core plugin that comes with MediaGoblin, ask us for help!
|
||||||
|
|
||||||
|
If it's a plugin you got from somewhere else, ask them for help!
|
||||||
|
@ -42,6 +42,13 @@ def setup_plugins():
|
|||||||
# Go through and import all the modules that are subsections of
|
# Go through and import all the modules that are subsections of
|
||||||
# the [plugins] section and read in the hooks.
|
# the [plugins] section and read in the hooks.
|
||||||
for plugin_module, config in plugin_section.items():
|
for plugin_module, config in plugin_section.items():
|
||||||
|
# Skip any modules that start with -. This makes it easier for
|
||||||
|
# someone to tweak their configuration so as to not load a
|
||||||
|
# plugin without having to remove swaths of plugin
|
||||||
|
# configuration.
|
||||||
|
if plugin_module.startswith('-'):
|
||||||
|
continue
|
||||||
|
|
||||||
_log.info("Importing plugin module: %s" % plugin_module)
|
_log.info("Importing plugin module: %s" % plugin_module)
|
||||||
pman.register_plugin(plugin_module)
|
pman.register_plugin(plugin_module)
|
||||||
# If this throws errors, that's ok--it'll halt mediagoblin
|
# If this throws errors, that's ok--it'll halt mediagoblin
|
||||||
|
@ -153,3 +153,23 @@ def test_same_plugin_twice():
|
|||||||
# Make sure _setup_plugin_called was called once
|
# Make sure _setup_plugin_called was called once
|
||||||
import mediagoblin.plugins.sampleplugin
|
import mediagoblin.plugins.sampleplugin
|
||||||
eq_(mediagoblin.plugins.sampleplugin._setup_plugin_called, 1)
|
eq_(mediagoblin.plugins.sampleplugin._setup_plugin_called, 1)
|
||||||
|
|
||||||
|
|
||||||
|
@with_cleanup()
|
||||||
|
def test_disabled_plugin():
|
||||||
|
"""Run setup_plugins with a single working plugin twice"""
|
||||||
|
cfg = build_config([
|
||||||
|
('mediagoblin', {}, []),
|
||||||
|
('plugins', {}, [
|
||||||
|
('-mediagoblin.plugins.sampleplugin', {}, []),
|
||||||
|
])
|
||||||
|
])
|
||||||
|
|
||||||
|
mg_globals.app_config = cfg['mediagoblin']
|
||||||
|
mg_globals.global_config = cfg
|
||||||
|
|
||||||
|
pman = pluginapi.PluginManager()
|
||||||
|
setup_plugins()
|
||||||
|
|
||||||
|
# Make sure we didn't load the plugin
|
||||||
|
eq_(len(pman.plugins), 0)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user