[issue2551332] roundup-admin updateconfig does not preserve DEFAULT section or interpolation tokens
John Rouillard <[email protected]> Sun, 14 Apr 2024 23:52:05 +0000
| Newsgroups | gmane.comp.bug-tracking.roundup.devel |
|---|---|
| Message-ID | <[email protected]> |
New submission from John Rouillard: The standard Python configparser allows the following in config.ini: [DEFAULT] local_admin_email = [email protected] [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 ([email protected]). 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? ---------- components: Command-line interface messages: 7984 nosy: rouilj severity: normal status: new title: roundup-admin updateconfig does not preserve DEFAULT section or interpolation tokens _________________________________________________ Roundup tracker <[email protected]> <https://issues.roundup-tracker.org/issue2551332> _________________________________________________