diff 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
line wrap: on
line diff
--- a/rhodecode/controllers/admin/repos_groups.py	Thu May 26 01:06:33 2011 +0200
+++ b/rhodecode/controllers/admin/repos_groups.py	Thu May 26 01:28:06 2011 +0200
@@ -56,9 +56,9 @@
 
         repo_group = Group.get(group_id)
 
-        defaults = repo_group.get_dict()
+        data = repo_group.get_dict()
 
-        return defaults
+        return data
 
     @HasPermissionAnyDecorator('hg.admin')
     def index(self, format='html'):
@@ -140,7 +140,7 @@
                 encoding="UTF-8")
         except Exception:
             log.error(traceback.format_exc())
-            h.flash(_('error occurred during creation of repos group %s') \
+            h.flash(_('error occurred during update of repos group %s') \
                     % request.POST.get('group_name'), category='error')
 
         return redirect(url('repos_groups'))
@@ -223,9 +223,15 @@
     def edit(self, id, format='html'):
         """GET /repos_groups/id/edit: Form to edit an existing item"""
         # url('edit_repos_group', id=ID)
+
+        id = int(id)
+
         c.repos_group = Group.get(id)
         defaults = self.__load_data(id)
 
+        # we need to exclude this group from the group list for editing
+        c.repo_groups = filter(lambda x:x[0] != id, c.repo_groups)
+
         return htmlfill.render(
             render('admin/repos_groups/repos_groups_edit.html'),
             defaults=defaults,