Changeset - 644b7a16d29c
[Not reviewed]
default
0 2 0
Mads Kiilerich (mads) - 5 years ago 2021-01-11 00:06:52
mads@kiilerich.com
hooks: reserve .kallithea_ hooks namespace for internal use
2 files changed with 3 insertions and 3 deletions:
0 comments (0 inline, 0 general)
kallithea/controllers/admin/settings.py
Show inline comments
 
@@ -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')
kallithea/tests/functional/test_admin_settings.py
Show inline comments
 
@@ -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')
 

	
0 comments (0 inline, 0 general)