Context plug-ins

Context plug-ins extend or override context variables passed to templates.

You may have an arbitrary number of context plug-ins, e.g. to load information about billing, account status, support tickets etc.

Each context plug-in can indicate whether it should be loaded based on the content of the current context. This enables them to “fire” based on the event being notified, or the recipient, or more.

Note

The class for context plugins was renamed in Tattler version 1.2.0 .

Up until Tattler version 1.1.1 you would inherit from class ContextTattlerPlugin in order to define a context plug-in.

Since Tattler version 1.2.0, the class was renamed to ContextPlugin for simplicity and symmetry with Addressbook plug-ins.

Name ContextTattlerPlugin is still available as an alias for backward compatibility, but you’ll get a deprecation notice when plug-ins inheriting from it are loaded.

Writing a context plug-in

Context plug-ins are python files that

Keep in mind that plug-in filenames must end with _tattler_plugin.py; other filenames are ignored.

To create a context plug-in, refer to the respective section in the quickstart.

Tattler’s repository includes sample plug-ins <https://github.com/tattler-community/tattler-community/blob/main/plugins/sqlcontext_tattler_plugin.py>, so it’s a good idea for you to start from there.

You may organize tattler plug-ins in either of two locations:

  • a /usr/libexec/tattler directory, if you opted to place tattler data into your main filesystem hierarchy.

  • a tattler/plugins directory, if you opted to place tattler data into an own directory.