[Mailman-Developers] Python 3
barry at python.org
Sat Dec 27 05:08:20 CET 2014
On Dec 26, 2014, at 11:02 PM, Aurelien Bompard wrote:
>> But there could be! I took a very quick look at HK (but not KittyStore)
>> and it doesn't look like you need much. What if I added a REST API to
>> access the core's system configuration settings?
>That would work.
It turned out to be almost ridiculously easy, so that probably means it's a
good idea <wink>. Quoting from the documentation:
The entire system configuration is available through the REST API. You can
get a list of all defined sections.
sections: ['antispam', 'archiver.mail_archive', 'archiver.master', ...
You can also get all the values for a particular section.
sender_headers: from from_ reply-to sender
site_owner: noreply at example.com
Dotted section names work too, for example, to get the French language
Of course, these configuration resources are read-only. Also, I am
deprecating the `/<api>/system` resource path; for backward compatibility this
will still return the system versions, but you'll notice that the self_link
now points to `<api>/system/versions` which is the new canonical resource
path. I'll remove the old path when the API version gets rev'd.
This makes a good point though: I'm not outright discouraging applications
from using core as a library, and in fact that was part of the point of making
everything importable via the `mailman` package. But I'm far from ready to
make any guarantees of stability for the internal API, including interfaces.
The REST API however I *am* making guarantees about, as evidenced by using an
API version at the root of the resource tree.
Note that configuration values are verbatim strings. You might need to
convert the value to some typed data, e.g. [mailman]pending_request_lifetime
has a value of '3d' which is shorthand for a timedelta. Clients must convert
those data types themselves. Similarly for ints, booleans, etc. Multiline or
whitespace separated strings values must be .split() by the client.
But you *do* have access to all configuration settings now, although only on
the py3 branch atm.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 819 bytes
Desc: OpenPGP digital signature
More information about the Mailman-Developers