Mercurial > kallithea
changeset 4045:9b4ba12ef8c3
Add ini option to controll custom advanced hooks settings
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Thu, 27 Jun 2013 00:47:15 +0200 |
parents | af733fa965b0 |
children | 38ab60c1fb2b |
files | development.ini production.ini rhodecode/bin/template.ini.mako rhodecode/config/deployment.ini_tmpl rhodecode/controllers/admin/settings.py rhodecode/lib/base.py rhodecode/templates/admin/settings/hooks.html |
diffstat | 7 files changed, 45 insertions(+), 24 deletions(-) [+] |
line wrap: on
line diff
--- a/development.ini Thu Jun 27 00:30:06 2013 +0200 +++ b/development.ini Thu Jun 27 00:47:15 2013 +0200 @@ -171,7 +171,7 @@ #clone_uri = {scheme}://{user}{pass}{netloc}{path} -## issue tracker RhodeCode (leave blank to disable, absent for default) +## issue tracker for RhodeCode (leave blank to disable, absent for default) #bugtracker = http://bitbucket.org/marcinkuzminski/rhodecode/issues ## issue tracking mapping for commits messages @@ -219,8 +219,13 @@ ## codes don't break the transactions while 4XX codes do lock_ret_code = 423 +## allows to change the repository location in settings page allow_repo_location_change = True +## allows to setup custom hooks in settings page +allow_custom_hooks_settings = True + + #################################### ### CELERY CONFIG #### ####################################
--- a/production.ini Thu Jun 27 00:30:06 2013 +0200 +++ b/production.ini Thu Jun 27 00:47:15 2013 +0200 @@ -219,8 +219,13 @@ ## codes don't break the transactions while 4XX codes do lock_ret_code = 423 +## allows to change the repository location in settings page allow_repo_location_change = True +## allows to setup custom hooks in settings page +allow_custom_hooks_settings = True + + #################################### ### CELERY CONFIG #### ####################################
--- a/rhodecode/bin/template.ini.mako Thu Jun 27 00:30:06 2013 +0200 +++ b/rhodecode/bin/template.ini.mako Thu Jun 27 00:47:15 2013 +0200 @@ -227,9 +227,12 @@ <%text>## codes don't break the transactions while 4XX codes do</%text> lock_ret_code = 423 -<%text>## allow chaning the repository store location from web interface</%text> +<%text>## allows to change the repository location in settings page</%text> allow_repo_location_change = True +<%text>## allows to setup custom hooks in settings page</%text> +allow_custom_hooks_settings = True + <%text> #################################### ### CELERY CONFIG ####
--- a/rhodecode/config/deployment.ini_tmpl Thu Jun 27 00:30:06 2013 +0200 +++ b/rhodecode/config/deployment.ini_tmpl Thu Jun 27 00:47:15 2013 +0200 @@ -219,8 +219,13 @@ ## codes don't break the transactions while 4XX codes do lock_ret_code = 423 +## allows to change the repository location in settings page allow_repo_location_change = True +## allows to setup custom hooks in settings page +allow_custom_hooks_settings = True + + #################################### ### CELERY CONFIG #### ####################################
--- a/rhodecode/controllers/admin/settings.py Thu Jun 27 00:30:06 2013 +0200 +++ b/rhodecode/controllers/admin/settings.py Thu Jun 27 00:47:15 2013 +0200 @@ -309,30 +309,31 @@ 'application settings'), category='error') if setting_id == 'hooks': - ui_key = request.POST.get('new_hook_ui_key') - ui_value = request.POST.get('new_hook_ui_value') - try: + if c.visual.allow_custom_hooks_settings: + ui_key = request.POST.get('new_hook_ui_key') + ui_value = request.POST.get('new_hook_ui_value') + try: - if ui_value and ui_key: - RhodeCodeUi.create_or_update_hook(ui_key, ui_value) - h.flash(_('Added new hook'), - category='success') + if ui_value and ui_key: + RhodeCodeUi.create_or_update_hook(ui_key, ui_value) + h.flash(_('Added new hook'), + category='success') - # check for edits - update = False - _d = request.POST.dict_of_lists() - for k, v in zip(_d.get('hook_ui_key', []), - _d.get('hook_ui_value_new', [])): - RhodeCodeUi.create_or_update_hook(k, v) - update = True + # check for edits + update = False + _d = request.POST.dict_of_lists() + for k, v in zip(_d.get('hook_ui_key', []), + _d.get('hook_ui_value_new', [])): + RhodeCodeUi.create_or_update_hook(k, v) + update = True - if update: - h.flash(_('Updated hooks'), category='success') - Session().commit() - except Exception: - log.error(traceback.format_exc()) - h.flash(_('Error occurred during hook creation'), - category='error') + if update: + h.flash(_('Updated hooks'), category='success') + Session().commit() + except Exception: + log.error(traceback.format_exc()) + h.flash(_('Error occurred during hook creation'), + category='error') return redirect(url('admin_edit_setting', setting_id='hooks'))
--- a/rhodecode/lib/base.py Thu Jun 27 00:30:06 2013 +0200 +++ b/rhodecode/lib/base.py Thu Jun 27 00:47:15 2013 +0200 @@ -279,6 +279,7 @@ ## INI stored self.cut_off_limit = int(config.get('cut_off_limit')) c.visual.allow_repo_location_change = str2bool(config.get('allow_repo_location_change', True)) + c.visual.allow_custom_hooks_settings = str2bool(config.get('allow_custom_hooks_settings', True)) c.repo_name = get_repo_slug(request) # can be empty c.backends = BACKENDS.keys()
--- a/rhodecode/templates/admin/settings/hooks.html Thu Jun 27 00:30:06 2013 +0200 +++ b/rhodecode/templates/admin/settings/hooks.html Thu Jun 27 00:47:15 2013 +0200 @@ -36,7 +36,7 @@ % endfor </div> </div> - + % if c.visual.allow_custom_hooks_settings: <h3>${_('Custom hooks')}</h3> ${h.form(url('admin_setting', setting_id='hooks'),method='put')} <div class="form"> @@ -75,6 +75,7 @@ </div> </div> ${h.end_form()} + % endif </div> <script type="text/javascript"> function ajaxActionHook(hook_id,field_id) {