Add warnings about imports in the settings file, to avoid breaking the

multiprocessing feature.
This commit is contained in:
Simon Conseil
2014-09-04 22:49:01 +02:00
parent 15091deeb5
commit 52ff2b947d
3 changed files with 20 additions and 6 deletions

View File

@@ -7,15 +7,24 @@ How to use plugins
Plugins must be specified with the ``plugins`` setting:
.. code-block:: python
plugins = ['sigal.plugins.adjust', 'sigal.plugins.copyright']
You can either specify the name of the module which contains the plugin, or
import the plugin before adding it to the list:
.. code-block:: python
from sigal.plugins import copyright
plugins = ['sigal.plugins.adjust', copyright]
You can either specify the name of the module which contains the plugin, or
import the plugin before adding it to the list. The ``plugin_paths`` setting
can be used to specify paths to search for plugins (if they are not in the
python path).
.. note:: Using an import like this will break the multiprocessing feature,
because the settings dict must be serializable. So in most cases you should
prefer the first option.
The ``plugin_paths`` setting can be used to specify paths to search for plugins
(if they are not in the python path).
Write a new plugin
------------------

View File

@@ -138,6 +138,12 @@ ignore_files = []
# Plugins
# --------
# List of plugins to use. The values must be a path than can be imported.
# Another option is to import the plugin and put the module in the list, but
# this will break with the multiprocessing feature (the settings dict obtained
# from this file must be serializable).
# plugins = ['sigal.plugins.adjust', 'sigal.plugins.copyright']
# Add a copyright text on the image (default: '')
# copyright = "© An example copyright message"

View File

@@ -8,8 +8,7 @@ keep_orig = True
links = [('Example link', 'http://example.org'),
('Another link', 'http://example.org')]
from sigal.plugins import copyright
plugins = ['sigal.plugins.adjust', copyright]
plugins = ['sigal.plugins.adjust', 'sigal.plugins.copyright']
copyright = u"© An example copyright message"
adjust_options = {'color': 0.0, 'brightness': 1.0,
'contrast': 1.0, 'sharpness': 0.0}