Mercurial > p > roundup > code
changeset 8540:e8d1da6e3571
bug: fix traceback in roundup-admin init with bad config values
initialize accepts setting values for config.ini file settings. If
they are not valid, you got a python traceback.
ConfigurationError exceptions are now trapped. The admin.py's
usageError_feedback method is used to inform the user. Also the
feedback message now starts with a newline making it easier to read by
separating it from command that caused the issue.
| author | John Rouillard <rouilj@ieee.org> |
|---|---|
| date | Mon, 23 Mar 2026 13:18:41 -0400 |
| parents | 4d09c8046cde |
| children | 7a7f6ee0a09e |
| files | CHANGES.txt roundup/admin.py |
| diffstat | 2 files changed, 12 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/CHANGES.txt Sun Mar 22 22:40:11 2026 -0400 +++ b/CHANGES.txt Mon Mar 23 13:18:41 2026 -0400 @@ -57,7 +57,12 @@ - change the html templates so that the password is not required if the ``login_empty_passwords`` setting is enabled in ``config.ini``. Directions for your tracker are in upgrading.txt. (John Rouillard) - +- fix traceback displayed when roundup-admin install was used with + invalid settings for config.ini. It now reports the error and + provides the usage output. Also usage output starts with a newline + to provide a blank line between the command and the output to + improve readability. (John Rouillard) + Features: - add support for authorized changes. User can be prompted to enter
--- a/roundup/admin.py Sun Mar 22 22:40:11 2026 -0400 +++ b/roundup/admin.py Mon Mar 23 13:18:41 2026 -0400 @@ -39,6 +39,7 @@ from roundup.anypy.my_input import my_input from roundup.anypy.strings import repr_export from roundup.configuration import ( + ConfigurationError, CoreConfig, NoConfigError, Option, @@ -1488,7 +1489,10 @@ defns[k] = template_config[k] # install! - init.install(tracker_home, templates[template]['path'], settings=defns) + try: + init.install(tracker_home, templates[template]['path'], settings=defns) + except ConfigurationError as e: + raise UsageError(e) # Remove config_ini.ini file from tracker_home (not template dir). # Ignore file not found - not all templates have @@ -2350,7 +2354,7 @@ self.do_genconfig(args, update=True) def usageError_feedback(self, message, function): - print(_('Error: %s') % message) + print(_('\nError: %s') % message) print() print(function.__doc__) return 1
