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