comparison rhodecode/controllers/admin/repos_groups.py @ 1349:526120c77a38 beta

#47 added editing of groups, and moving them between. Added check constraint for groups to prevent of loops
author Marcin Kuzminski <marcin@python-works.com>
date Thu, 26 May 2011 01:28:06 +0200
parents 43b8e161be3f
children 9c0f5d558789
comparison
equal deleted inserted replaced
1348:dccba44ee176 1349:526120c77a38
54 """ 54 """
55 self.__load_defaults() 55 self.__load_defaults()
56 56
57 repo_group = Group.get(group_id) 57 repo_group = Group.get(group_id)
58 58
59 defaults = repo_group.get_dict() 59 data = repo_group.get_dict()
60 60
61 return defaults 61 return data
62 62
63 @HasPermissionAnyDecorator('hg.admin') 63 @HasPermissionAnyDecorator('hg.admin')
64 def index(self, format='html'): 64 def index(self, format='html'):
65 """GET /repos_groups: All items in the collection""" 65 """GET /repos_groups: All items in the collection"""
66 # url('repos_groups') 66 # url('repos_groups')
138 errors=errors.error_dict or {}, 138 errors=errors.error_dict or {},
139 prefix_error=False, 139 prefix_error=False,
140 encoding="UTF-8") 140 encoding="UTF-8")
141 except Exception: 141 except Exception:
142 log.error(traceback.format_exc()) 142 log.error(traceback.format_exc())
143 h.flash(_('error occurred during creation of repos group %s') \ 143 h.flash(_('error occurred during update of repos group %s') \
144 % request.POST.get('group_name'), category='error') 144 % request.POST.get('group_name'), category='error')
145 145
146 return redirect(url('repos_groups')) 146 return redirect(url('repos_groups'))
147 147
148 148
221 221
222 @HasPermissionAnyDecorator('hg.admin') 222 @HasPermissionAnyDecorator('hg.admin')
223 def edit(self, id, format='html'): 223 def edit(self, id, format='html'):
224 """GET /repos_groups/id/edit: Form to edit an existing item""" 224 """GET /repos_groups/id/edit: Form to edit an existing item"""
225 # url('edit_repos_group', id=ID) 225 # url('edit_repos_group', id=ID)
226
227 id = int(id)
228
226 c.repos_group = Group.get(id) 229 c.repos_group = Group.get(id)
227 defaults = self.__load_data(id) 230 defaults = self.__load_data(id)
231
232 # we need to exclude this group from the group list for editing
233 c.repo_groups = filter(lambda x:x[0] != id, c.repo_groups)
228 234
229 return htmlfill.render( 235 return htmlfill.render(
230 render('admin/repos_groups/repos_groups_edit.html'), 236 render('admin/repos_groups/repos_groups_edit.html'),
231 defaults=defaults, 237 defaults=defaults,
232 encoding="UTF-8", 238 encoding="UTF-8",