##// END OF EJS Templates
Removed hardcoded hooks names from settings....
marcink -
r2401:e2af60e4 beta
parent child Browse files
Show More
@@ -174,7 +174,8 b' class SettingsController(BaseController)'
174 174 application_form = ApplicationUiSettingsForm()()
175 175 try:
176 176 form_result = application_form.to_python(dict(request.POST))
177
177 # fix namespaces for hooks
178 _f = lambda s: s.replace('.', '_')
178 179 try:
179 180
180 181 hgsettings1 = self.sa.query(RhodeCodeUi)\
@@ -187,28 +188,28 b' class SettingsController(BaseController)'
187 188
188 189 #HOOKS
189 190 hgsettings3 = self.sa.query(RhodeCodeUi)\
190 .filter(RhodeCodeUi.ui_key == 'changegroup.update').one()
191 hgsettings3.ui_active = \
192 bool(form_result['hooks_changegroup_update'])
191 .filter(RhodeCodeUi.ui_key == RhodeCodeUi.HOOK_UPDATE)\
192 .one()
193 hgsettings3.ui_active = bool(form_result[_f('hooks_%s' %
194 RhodeCodeUi.HOOK_UPDATE)])
193 195
194 196 hgsettings4 = self.sa.query(RhodeCodeUi)\
195 .filter(RhodeCodeUi.ui_key ==
196 'changegroup.repo_size').one()
197 hgsettings4.ui_active = \
198 bool(form_result['hooks_changegroup_repo_size'])
197 .filter(RhodeCodeUi.ui_key == RhodeCodeUi.HOOK_REPO_SIZE)\
198 .one()
199 hgsettings4.ui_active = bool(form_result[_f('hooks_%s' %
200 RhodeCodeUi.HOOK_REPO_SIZE)])
199 201
200 202 hgsettings5 = self.sa.query(RhodeCodeUi)\
201 .filter(RhodeCodeUi.ui_key ==
202 'pretxnchangegroup.push_logger').one()
203 hgsettings5.ui_active = \
204 bool(form_result['hooks_pretxnchangegroup'
205 '_push_logger'])
203 .filter(RhodeCodeUi.ui_key == RhodeCodeUi.HOOK_PUSH)\
204 .one()
205 hgsettings5.ui_active = bool(form_result[_f('hooks_%s' %
206 RhodeCodeUi.HOOK_PUSH)])
206 207
207 208 hgsettings6 = self.sa.query(RhodeCodeUi)\
208 .filter(RhodeCodeUi.ui_key ==
209 'preoutgoing.pull_logger').one()
210 hgsettings6.ui_active = \
211 bool(form_result['hooks_preoutgoing_pull_logger'])
209 .filter(RhodeCodeUi.ui_key == RhodeCodeUi.HOOK_PULL)\
210 .one()
211 hgsettings6.ui_active = bool(form_result[_f('hooks_%s' %
212 RhodeCodeUi.HOOK_PULL)])
212 213
213 214 self.sa.add(hgsettings1)
214 215 self.sa.add(hgsettings2)
@@ -269,6 +269,10 b' class RhodeCodeUi(Base, BaseModel):'
269 269 return q.all()
270 270
271 271 @classmethod
272 def get_repos_location(cls):
273 return cls.get_by_key('/').one().ui_value
274
275 @classmethod
272 276 def create_or_update_hook(cls, key, val):
273 277 new_ui = cls.get_by_key(key).scalar() or cls()
274 278 new_ui.ui_section = 'hooks'
General Comments 0
You need to be logged in to leave comments. Login now