##// END OF EJS Templates
integrations: fix re-submit of form on repo integrations.
marcink -
r1384:13f7d9a4 default
parent child Browse files
Show More
@@ -142,7 +142,6 b' class IntegrationSettingsViewBase(object'
142 permissions=self.request.user.permissions,
142 permissions=self.request.user.permissions,
143 no_scope=not self.admin_view)
143 no_scope=not self.admin_view)
144
144
145
146 def _form_defaults(self):
145 def _form_defaults(self):
147 defaults = {}
146 defaults = {}
148
147
@@ -284,7 +283,6 b' class IntegrationSettingsViewBase(object'
284 child_repos_only=scope['child_repos_only'],
283 child_repos_only=scope['child_repos_only'],
285 )
284 )
286
285
287
288 self.integration.settings = valid_data['settings']
286 self.integration.settings = valid_data['settings']
289 Session().commit()
287 Session().commit()
290 # Display success message and redirect.
288 # Display success message and redirect.
@@ -293,7 +291,6 b' class IntegrationSettingsViewBase(object'
293 integration_name=self.IntegrationType.display_name),
291 integration_name=self.IntegrationType.display_name),
294 queue='success')
292 queue='success')
295
293
296
297 # if integration scope changes, we must redirect to the right place
294 # if integration scope changes, we must redirect to the right place
298 # keeping in mind if the original view was for /repo/ or /_admin/
295 # keeping in mind if the original view was for /repo/ or /_admin/
299 admin_view = not (self.repo or self.repo_group)
296 admin_view = not (self.repo or self.repo_group)
@@ -347,8 +344,8 b' class IntegrationSettingsViewBase(object'
347 assert sort_field in ('name', 'integration_type', 'enabled', 'scope')
344 assert sort_field in ('name', 'integration_type', 'enabled', 'scope')
348
345
349 integrations.sort(
346 integrations.sort(
350 key=lambda x: getattr(x[1], sort_field), reverse=(sort_dir=='desc'))
347 key=lambda x: getattr(x[1], sort_field),
351
348 reverse=(sort_dir == 'desc'))
352
349
353 page_url = webhelpers.paginate.PageURL(
350 page_url = webhelpers.paginate.PageURL(
354 self.request.path, self.request.GET)
351 self.request.path, self.request.GET)
@@ -375,6 +372,7 b' class IntegrationSettingsViewBase(object'
375 }
372 }
376 return template_context
373 return template_context
377
374
375
378 class GlobalIntegrationsView(IntegrationSettingsViewBase):
376 class GlobalIntegrationsView(IntegrationSettingsViewBase):
379 def perm_check(self, user):
377 def perm_check(self, user):
380 return auth.HasPermissionAll('hg.admin').check_permissions(user=user)
378 return auth.HasPermissionAll('hg.admin').check_permissions(user=user)
@@ -135,7 +135,7 b' class IntegrationScopeType(colander.Sche'
135 return {
135 return {
136 'repo': repo,
136 'repo': repo,
137 'repo_group': None,
137 'repo_group': None,
138 'child_repos_only': None,
138 'child_repos_only': False,
139 }
139 }
140 elif cstruct.startswith('repogroup-recursive:'):
140 elif cstruct.startswith('repogroup-recursive:'):
141 repo_group = RepoGroup.get_by_group_name(cstruct.split(':')[1])
141 repo_group = RepoGroup.get_by_group_name(cstruct.split(':')[1])
@@ -47,7 +47,7 b' class TestIntegrationSchema(object):'
47 (
47 (
48 'repo:%s' % repo.repo_name,
48 'repo:%s' % repo.repo_name,
49 {
49 {
50 'child_repos_only': None,
50 'child_repos_only': False,
51 'repo_group': None,
51 'repo_group': None,
52 'repo': repo,
52 'repo': repo,
53 },
53 },
General Comments 0
You need to be logged in to leave comments. Login now