Mercurial > kallithea
comparison rhodecode/controllers/admin/settings.py @ 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 | 5293d4bbb1ea |
children | 7676606f7622 |
comparison
equal
deleted
inserted
replaced
4044:af733fa965b0 | 4045:9b4ba12ef8c3 |
---|---|
307 log.error(traceback.format_exc()) | 307 log.error(traceback.format_exc()) |
308 h.flash(_('Error occurred during updating ' | 308 h.flash(_('Error occurred during updating ' |
309 'application settings'), category='error') | 309 'application settings'), category='error') |
310 | 310 |
311 if setting_id == 'hooks': | 311 if setting_id == 'hooks': |
312 ui_key = request.POST.get('new_hook_ui_key') | 312 if c.visual.allow_custom_hooks_settings: |
313 ui_value = request.POST.get('new_hook_ui_value') | 313 ui_key = request.POST.get('new_hook_ui_key') |
314 try: | 314 ui_value = request.POST.get('new_hook_ui_value') |
315 | 315 try: |
316 if ui_value and ui_key: | 316 |
317 RhodeCodeUi.create_or_update_hook(ui_key, ui_value) | 317 if ui_value and ui_key: |
318 h.flash(_('Added new hook'), | 318 RhodeCodeUi.create_or_update_hook(ui_key, ui_value) |
319 category='success') | 319 h.flash(_('Added new hook'), |
320 | 320 category='success') |
321 # check for edits | 321 |
322 update = False | 322 # check for edits |
323 _d = request.POST.dict_of_lists() | 323 update = False |
324 for k, v in zip(_d.get('hook_ui_key', []), | 324 _d = request.POST.dict_of_lists() |
325 _d.get('hook_ui_value_new', [])): | 325 for k, v in zip(_d.get('hook_ui_key', []), |
326 RhodeCodeUi.create_or_update_hook(k, v) | 326 _d.get('hook_ui_value_new', [])): |
327 update = True | 327 RhodeCodeUi.create_or_update_hook(k, v) |
328 | 328 update = True |
329 if update: | 329 |
330 h.flash(_('Updated hooks'), category='success') | 330 if update: |
331 Session().commit() | 331 h.flash(_('Updated hooks'), category='success') |
332 except Exception: | 332 Session().commit() |
333 log.error(traceback.format_exc()) | 333 except Exception: |
334 h.flash(_('Error occurred during hook creation'), | 334 log.error(traceback.format_exc()) |
335 category='error') | 335 h.flash(_('Error occurred during hook creation'), |
336 category='error') | |
336 | 337 |
337 return redirect(url('admin_edit_setting', setting_id='hooks')) | 338 return redirect(url('admin_edit_setting', setting_id='hooks')) |
338 | 339 |
339 if setting_id == 'email': | 340 if setting_id == 'email': |
340 test_email = request.POST.get('test_email') | 341 test_email = request.POST.get('test_email') |