diff --git a/pylons_app/controllers/admin/settings.py b/pylons_app/controllers/admin/settings.py --- a/pylons_app/controllers/admin/settings.py +++ b/pylons_app/controllers/admin/settings.py @@ -156,8 +156,23 @@ class SettingsController(BaseController) .filter(HgAppUi.ui_key == '/').one() hgsettings2.ui_value = form_result['paths_root_path'] + + #HOOKS + hgsettings3 = self.sa.query(HgAppUi)\ + .filter(HgAppUi.ui_key == 'changegroup.update').one() + hgsettings3.ui_active = bool(form_result['hooks_changegroup_update']) + + hgsettings4 = self.sa.query(HgAppUi)\ + .filter(HgAppUi.ui_key == 'changegroup.repo_size').one() + hgsettings4.ui_active = bool(form_result['hooks_changegroup_repo_size']) + + + + self.sa.add(hgsettings1) self.sa.add(hgsettings2) + self.sa.add(hgsettings3) + self.sa.add(hgsettings4) self.sa.commit() h.flash(_('Updated application settings'), diff --git a/pylons_app/lib/utils.py b/pylons_app/lib/utils.py --- a/pylons_app/lib/utils.py +++ b/pylons_app/lib/utils.py @@ -123,8 +123,18 @@ def get_hg_ui_settings(): raise Exception('Could not get application ui settings !') settings = {} for each in ret: - k = each.ui_key if each.ui_key != '/' else 'root_path' - settings[each.ui_section + '_' + k] = each.ui_value + k = each.ui_key + v = each.ui_value + if k == '/': + k = 'root_path' + + if k.find('.') != -1: + k = k.replace('.', '_') + + if each.ui_section == 'hooks': + v = each.ui_active + + settings[each.ui_section + '_' + k] = v return settings diff --git a/pylons_app/model/forms.py b/pylons_app/model/forms.py --- a/pylons_app/model/forms.py +++ b/pylons_app/model/forms.py @@ -323,6 +323,8 @@ def ApplicationUiSettingsForm(): filter_extra_fields = False web_push_ssl = OneOf(['true', 'false'], if_missing='false') paths_root_path = All(ValidPath(), UnicodeString(strip=True, min=3, not_empty=True)) + hooks_changegroup_update = OneOf(['True', 'False'], if_missing=False) + hooks_changegroup_repo_size = OneOf(['True', 'False'], if_missing=False) return _ApplicationUiSettingsForm diff --git a/pylons_app/templates/admin/settings/settings.html b/pylons_app/templates/admin/settings/settings.html --- a/pylons_app/templates/admin/settings/settings.html +++ b/pylons_app/templates/admin/settings/settings.html @@ -89,7 +89,7 @@
- +
@@ -98,13 +98,29 @@
+ +
+
+ +
+
+
+ ${h.checkbox('hooks_changegroup_update','True')} + +
+
+ ${h.checkbox('hooks_changegroup_repo_size','True')} + +
+
+
- ${h.text('paths_root_path',size=30,disabled="disabled")} + ${h.text('paths_root_path',size=30,readonly="readonly")} ${_('unlock')}
@@ -120,7 +136,7 @@