Mercurial > kallithea
changeset 8840:644b7a16d29c
hooks: reserve .kallithea_ hooks namespace for internal use
author | Mads Kiilerich <mads@kiilerich.com> |
---|---|
date | Mon, 11 Jan 2021 00:06:52 +0100 |
parents | 25c51511c8eb |
children | 79567af5523e |
files | kallithea/controllers/admin/settings.py kallithea/tests/functional/test_admin_settings.py |
diffstat | 2 files changed, 3 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/kallithea/controllers/admin/settings.py Mon Jan 11 00:23:20 2021 +0100 +++ b/kallithea/controllers/admin/settings.py Mon Jan 11 00:06:52 2021 +0100 @@ -332,8 +332,8 @@ ui_key = ui_key and ui_key.strip() if ui_key in (x.ui_key for x in db.Ui.get_custom_hooks()): webutils.flash(_('Hook already exists'), category='error') - elif ui_key in (x.ui_key for x in db.Ui.get_builtin_hooks()): - webutils.flash(_('Builtin hooks are read-only. Please use another hook name.'), category='error') + elif ui_key and '.kallithea_' in ui_key: + webutils.flash(_('Hook names with ".kallithea_" are reserved for internal use. Please use another hook name.'), category='error') elif ui_value and ui_key: db.Ui.create_or_update_hook(ui_key, ui_value) webutils.flash(_('Added new hook'), category='success')
--- a/kallithea/tests/functional/test_admin_settings.py Mon Jan 11 00:23:20 2021 +0100 +++ b/kallithea/tests/functional/test_admin_settings.py Mon Jan 11 00:06:52 2021 +0100 @@ -95,7 +95,7 @@ new_hook_ui_value='attempted_new_value', _session_csrf_secret_token=self.session_csrf_secret_token())) - self.checkSessionFlash(response, 'Builtin hooks are read-only') + self.checkSessionFlash(response, 'reserved for internal use') response = response.follow() response.mustcontain('changegroup.kallithea_update')