0
Beantwortet

How do you add a collection to Configure->Plugins

jobu1342 vor 6 Jahren aktualisiert von Eugene Pankov (Project coordinator) vor 6 Jahren 2
I've been working my way through the Ajenti API to develop a plugin, and up until now it has been going well. I need to add a list or collection to the configuration of my plugin, but I'm not sure how to go about doing it; after trying for hours to get it to work I thought I'd ask here.

This is the format of the data I would like to store:

default_classconfig = {
    'groups': [{"name": "Shield", "members": ["Nick Fury", "Thaddeus Dugan", "Gabriel Jones"]}, {...}...]
}

I've worked through a collection before, and I used a binder to bind to the collection, but the same techniques don't appear to apply to the ClassConfigEditor.

Antwort

Antwort
Beantwortet
Sorry for the delay. This is not possible at the moment; classconfigs are bound with simple bind:dict, which only allows binding one level of scalar values.

If you need a complex configuration tree, I suggest instead saving it to JSON or use a more convenient config-to-object binding Reconfigure (https://github.com/Eugeny/reconfigure)
Antwort
Beantwortet
Sorry for the delay. This is not possible at the moment; classconfigs are bound with simple bind:dict, which only allows binding one level of scalar values.

If you need a complex configuration tree, I suggest instead saving it to JSON or use a more convenient config-to-object binding Reconfigure (https://github.com/Eugeny/reconfigure)
BTW in latest Ajenti, you can bind to dict keys directly now with bind="[key]"