# HG changeset patch # User Mads Kiilerich # Date 2021-01-11 00:06:52 # Node ID 644b7a16d29cfbbf0edcead1a2f3eaf0b89dbadb # Parent 25c51511c8eb7dadc005c534851c6a26bb83acd9 hooks: reserve .kallithea_ hooks namespace for internal use diff --git a/kallithea/controllers/admin/settings.py b/kallithea/controllers/admin/settings.py --- a/kallithea/controllers/admin/settings.py +++ b/kallithea/controllers/admin/settings.py @@ -332,8 +332,8 @@ class SettingsController(base.BaseContro 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') diff --git a/kallithea/tests/functional/test_admin_settings.py b/kallithea/tests/functional/test_admin_settings.py --- a/kallithea/tests/functional/test_admin_settings.py +++ b/kallithea/tests/functional/test_admin_settings.py @@ -95,7 +95,7 @@ class TestAdminSettingsController(base.T 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')