Roundup Tracker - Issues

Message7984

Author rouilj
Recipients rouilj
Date 2024-04-14.23:52:05
Message-id <1713138725.51.0.681709725091.issue2551332@roundup.psfhosted.org>
In-reply-to
The standard Python configparser allows the following in config.ini:

   [DEFAULT]
   local_admin_email = admin@example.com

   [main]
   admin_email = %(local_admin_email)s

It can be useful to collect all the localized changes at the top to make
updating them (or seeing how things differ from the default) easier.
However when upgrading roundup using the updateconfig command to roundup-admin,
the new config file does not preserve the DEFAULT section. Also interpolation
tokens (e.g. %(local_admin_email)s are replaced with their values
(admin@example.com).

Adding interpolation=None to

        config = configparser.ConfigParser(config_defaults, interpolation=None)

in configuration.py:Config::load_ini does prevent the interpolation of the tokens.

A call to config.defaults() includes config_defaults plus the settings in the
DEFAULT section of config.ini. So we could add a self.ini_defaults to store
the dict we get from config.defaults() minus the settings in config_defaults.
Then this could be written as the DEFAULT section if self.ini_defaults is true
(has keys).

We also need to pass interpolation=None down from the call in admin.py::do_genconfig()
for the case where update is true.

If this is done, do_updateconfig should probably not call do_genconfig anymore. The
code for handling updates and warning when settings change is larger than the
original do_genconfig() code. Also we need to consider what happens if some of the
warning checks get an interpolation token rather than the actual data.

Sigh this is getting tricky. Maybe this is YAGNI?
History
Date User Action Args
2024-04-14 23:52:05rouiljsetrecipients: + rouilj
2024-04-14 23:52:05rouiljsetmessageid: <1713138725.51.0.681709725091.issue2551332@roundup.psfhosted.org>
2024-04-14 23:52:05rouiljlinkissue2551332 messages
2024-04-14 23:52:05rouiljcreate