Browse Source

Clarify plugin docs

Alec Nikolas Reiter 7 years ago
parent
commit
311f8bf9af
2 changed files with 27 additions and 6 deletions
  1. 23 3
      docs/hooks.rst
  2. 4 3
      docs/plugin_development.rst

+ 23 - 3
docs/hooks.rst

@@ -23,14 +23,34 @@ Python Hooks
 
 
 .. currentmodule:: flaskbb.plugins.spec
 .. currentmodule:: flaskbb.plugins.spec
 
 
+Application Startup Hooks
+~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Application startup hooks are called when the application is created,
+either through a WSGI server (uWSGI or gunicorn for example) or by
+the ``flaskbb`` command.
+
+Unless noted, all FlaskBB hooks are called after the relevant builtin
+FlaskBB setup has run (e.g. ``flaskbb_load_blueprints`` is called after
+all standard FlaskBB blueprints have been loaded).
+
+The hooks below are listed in the order they are called.
+
 .. autofunction:: flaskbb_extensions
 .. autofunction:: flaskbb_extensions
-.. autofunction:: flaskbb_load_translations
-.. autofunction:: flaskbb_load_migrations
 .. autofunction:: flaskbb_load_blueprints
 .. autofunction:: flaskbb_load_blueprints
+.. autofunction:: flaskbb_jinja_directives
 .. autofunction:: flaskbb_request_processors
 .. autofunction:: flaskbb_request_processors
 .. autofunction:: flaskbb_errorhandlers
 .. autofunction:: flaskbb_errorhandlers
-.. autofunction:: flaskbb_jinja_directives
+.. autofunction:: flaskbb_load_migrations
+.. autofunction:: flaskbb_load_translations
 .. autofunction:: flaskbb_additional_setup
 .. autofunction:: flaskbb_additional_setup
+
+FlaskBB CLI Hooks
+~~~~~~~~~~~~~~~~~
+
+These are hooks are only invoked when using the ``flaskbb``
+CLI.
+
 .. autofunction:: flaskbb_cli
 .. autofunction:: flaskbb_cli
 
 
 
 

+ 4 - 3
docs/plugin_development.rst

@@ -183,9 +183,10 @@ Each hook specification has a corresponding hook implementation. By default,
 all hooks that are prefix with ``flaskbb_`` will be marked as a standard
 all hooks that are prefix with ``flaskbb_`` will be marked as a standard
 hook implementation. It is possible to modify the behavior of hooks.
 hook implementation. It is possible to modify the behavior of hooks.
 For example, default hooks are called in LIFO registered order.
 For example, default hooks are called in LIFO registered order.
-A hookimpl can influence its call-time invocation position using special
-attributes. If marked with a "tryfirst" or "trylast" option it will be executed
-first or last respectively in the hook call loop::
+Although, registration order might not be deterministic. A hookimpl
+can influence its call-time invocation position using special attributes. If
+marked with a "tryfirst" or "trylast" option it will be executed first or last
+respectively in the hook call loop::
 
 
     hookimpl = HookimplMarker('flaskbb')
     hookimpl = HookimplMarker('flaskbb')