On 5/16/25 12:09 PM, Thomas Ward via Mailman-Developers wrote:
Assume that we're working with this in the /etc/mailman3/mailman.cfg
file for the configuration specific to the plugin:
[plugin.example]
class: example_mm_plugin.hooks.ExamplePlugin
enabled: yes
config_item_one: Foo
config_item_two: Bar
config_item_three: 1234567890
...
How would I, within `example_archiver.py`, be able to access and read
the custom configuration options that I've added to `plugin.example` in
the mailman.cfg file?
It's more complex than that. What you want in mailman.cfg is
```
[plugin.example]
class: example_mm_plugin.hooks.ExamplePlugin
enabled: yes
configuration: /path/to/example.cfg
```
and in /path/to/example.cfg
```
[plugin.example]
config_item_one: Foo
config_item_two: Bar
config_item_three: 1234567890
```
Then in example_archiver.py you would have things like
```
from mailman.config import config
from mailman.config.config import external_configuration
...
my_config = external_configuration(config.plugin.example.configuration)
# and then things like
item_one = my_config.get('plugin.example', 'config_item_one')
```
--
Mark Sapiro <m...@msapiro.net> The highway is for gamblers,
San Francisco Bay Area, California better use your sense - B. Dylan
_______________________________________________
Mailman-Developers mailing list -- mailman-developers@python.org
To unsubscribe send an email to mailman-developers-le...@python.org
https://mail.python.org/mailman3/lists/mailman-developers.python.org/
Mailman FAQ: https://wiki.list.org/x/AgA3
Security Policy: https://wiki.list.org/x/QIA9