aboutsummaryrefslogtreecommitdiffstats
path: root/docs/source/pluginwriter/api.rst
diff options
context:
space:
mode:
authorRodney Ewing <ewing.rj@gmail.com>2013-06-25 13:37:21 -0700
committerRodney Ewing <ewing.rj@gmail.com>2013-06-25 13:37:21 -0700
commitaf4414a85f3354a432e29ecf8cf39ffd926371e3 (patch)
tree34da18957bceb784aff8cd5c413fa8e8273068e9 /docs/source/pluginwriter/api.rst
parent5a1be074c0522c2151ab735eeb30a60c07ff7f7c (diff)
parent7fa4e19fc4e7d04175549ea2f21f8b741fbe69f2 (diff)
downloadmediagoblin-af4414a85f3354a432e29ecf8cf39ffd926371e3.tar.lz
mediagoblin-af4414a85f3354a432e29ecf8cf39ffd926371e3.tar.xz
mediagoblin-af4414a85f3354a432e29ecf8cf39ffd926371e3.zip
Merge remote-tracking branch 'upstream/master' into auth
Conflicts: mediagoblin/app.py mediagoblin/auth/forms.py mediagoblin/auth/tools.py mediagoblin/db/migrations.py mediagoblin/db/models.py mediagoblin/edit/views.py mediagoblin/plugins/basic_auth/tools.py mediagoblin/tests/test_edit.py
Diffstat (limited to 'docs/source/pluginwriter/api.rst')
-rw-r--r--docs/source/pluginwriter/api.rst26
1 files changed, 26 insertions, 0 deletions
diff --git a/docs/source/pluginwriter/api.rst b/docs/source/pluginwriter/api.rst
index 66def173..29adb691 100644
--- a/docs/source/pluginwriter/api.rst
+++ b/docs/source/pluginwriter/api.rst
@@ -69,6 +69,32 @@ example might look like::
This means that when people enable your plugin in their config you'll
be able to provide defaults as well as type validation.
+You can access this via the app_config variables in mg_globals, or you
+can use a shortcut to get your plugin's config section::
+
+ >>> from mediagoblin.tools import pluginapi
+ # Replace with the path to your plugin.
+ # (If an external package, it won't be part of mediagoblin.plugins)
+ >>> floobie_config = pluginapi.get_config('mediagoblin.plugins.floobifier')
+ >>> floobie_dir = floobie_config['floobie_dir']
+ # This is the same as the above
+ >>> from mediagoblin import mg_globals
+ >>> config = mg_globals.global_config['plugins']['mediagoblin.plugins.floobifier']
+ >>> floobie_dir = floobie_config['floobie_dir']
+
+A tip: you have access to the `%(here)s` variable in your config,
+which is the directory that the user's mediagoblin config is running
+out of. So for example, your plugin may need a "floobie" directory to
+store floobs in. You could give them a reasonable default that makes
+use of the default `user_dev` location, but allow users to override
+it, like so::
+
+ [plugin_spec]
+ floobie_dir = string(default="%(here)s/user_dev/floobs/")
+
+Note, this is relative to the user's mediagoblin config directory,
+*not* your plugin directory!
+
Context Hooks
-------------