annotate 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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1171
2ab211e0aecd changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
1 import logging
1345
3bce31f026b8 #47 implemented Adding of new repo_groups+forms+validators. Fixed sorting of repo groups by main names in multiple locations. Removed some unneeded calls to self.sa for exchange to .query() methods.
Marcin Kuzminski <marcin@python-works.com>
parents: 1343
diff changeset
2 import traceback
3bce31f026b8 #47 implemented Adding of new repo_groups+forms+validators. Fixed sorting of repo groups by main names in multiple locations. Removed some unneeded calls to self.sa for exchange to .query() methods.
Marcin Kuzminski <marcin@python-works.com>
parents: 1343
diff changeset
3 import formencode
3bce31f026b8 #47 implemented Adding of new repo_groups+forms+validators. Fixed sorting of repo groups by main names in multiple locations. Removed some unneeded calls to self.sa for exchange to .query() methods.
Marcin Kuzminski <marcin@python-works.com>
parents: 1343
diff changeset
4
3bce31f026b8 #47 implemented Adding of new repo_groups+forms+validators. Fixed sorting of repo groups by main names in multiple locations. Removed some unneeded calls to self.sa for exchange to .query() methods.
Marcin Kuzminski <marcin@python-works.com>
parents: 1343
diff changeset
5 from formencode import htmlfill
1193
523382549c45 Added repo group page showing what reposiories are inside a group
Marcin Kuzminski <marcin@python-works.com>
parents: 1171
diff changeset
6 from operator import itemgetter
1171
2ab211e0aecd changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
7
2ab211e0aecd changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
8 from pylons import request, response, session, tmpl_context as c, url
2ab211e0aecd changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
9 from pylons.controllers.util import abort, redirect
1345
3bce31f026b8 #47 implemented Adding of new repo_groups+forms+validators. Fixed sorting of repo groups by main names in multiple locations. Removed some unneeded calls to self.sa for exchange to .query() methods.
Marcin Kuzminski <marcin@python-works.com>
parents: 1343
diff changeset
10 from pylons.i18n.translation import _
1171
2ab211e0aecd changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
11
1345
3bce31f026b8 #47 implemented Adding of new repo_groups+forms+validators. Fixed sorting of repo groups by main names in multiple locations. Removed some unneeded calls to self.sa for exchange to .query() methods.
Marcin Kuzminski <marcin@python-works.com>
parents: 1343
diff changeset
12 from rhodecode.lib import helpers as h
3bce31f026b8 #47 implemented Adding of new repo_groups+forms+validators. Fixed sorting of repo groups by main names in multiple locations. Removed some unneeded calls to self.sa for exchange to .query() methods.
Marcin Kuzminski <marcin@python-works.com>
parents: 1343
diff changeset
13 from rhodecode.lib.auth import LoginRequired, HasPermissionAllDecorator, \
3bce31f026b8 #47 implemented Adding of new repo_groups+forms+validators. Fixed sorting of repo groups by main names in multiple locations. Removed some unneeded calls to self.sa for exchange to .query() methods.
Marcin Kuzminski <marcin@python-works.com>
parents: 1343
diff changeset
14 HasPermissionAnyDecorator
1171
2ab211e0aecd changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
15 from rhodecode.lib.base import BaseController, render
1193
523382549c45 Added repo group page showing what reposiories are inside a group
Marcin Kuzminski <marcin@python-works.com>
parents: 1171
diff changeset
16 from rhodecode.model.db import Group
1345
3bce31f026b8 #47 implemented Adding of new repo_groups+forms+validators. Fixed sorting of repo groups by main names in multiple locations. Removed some unneeded calls to self.sa for exchange to .query() methods.
Marcin Kuzminski <marcin@python-works.com>
parents: 1343
diff changeset
17 from rhodecode.model.repos_group import ReposGroupModel
3bce31f026b8 #47 implemented Adding of new repo_groups+forms+validators. Fixed sorting of repo groups by main names in multiple locations. Removed some unneeded calls to self.sa for exchange to .query() methods.
Marcin Kuzminski <marcin@python-works.com>
parents: 1343
diff changeset
18 from rhodecode.model.forms import ReposGroupForm
1171
2ab211e0aecd changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
19
2ab211e0aecd changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
20 log = logging.getLogger(__name__)
2ab211e0aecd changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
21
1245
5f2fbab7c429 PEP8ify - controllers
Marcin Kuzminski <marcin@python-works.com>
parents: 1193
diff changeset
22
1171
2ab211e0aecd changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
23 class ReposGroupsController(BaseController):
2ab211e0aecd changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
24 """REST Controller styled on the Atom Publishing Protocol"""
2ab211e0aecd changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
25 # To properly map this controller, ensure your config/routing.py
2ab211e0aecd changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
26 # file has a resource setup:
2ab211e0aecd changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
27 # map.resource('repos_group', 'repos_groups')
2ab211e0aecd changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
28
1347
43b8e161be3f #47 implemented basic edition of groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1346
diff changeset
29 @LoginRequired()
43b8e161be3f #47 implemented basic edition of groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1346
diff changeset
30 def __before__(self):
43b8e161be3f #47 implemented basic edition of groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1346
diff changeset
31 super(ReposGroupsController, self).__before__()
43b8e161be3f #47 implemented basic edition of groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1346
diff changeset
32
1345
3bce31f026b8 #47 implemented Adding of new repo_groups+forms+validators. Fixed sorting of repo groups by main names in multiple locations. Removed some unneeded calls to self.sa for exchange to .query() methods.
Marcin Kuzminski <marcin@python-works.com>
parents: 1343
diff changeset
33 def __load_defaults(self):
3bce31f026b8 #47 implemented Adding of new repo_groups+forms+validators. Fixed sorting of repo groups by main names in multiple locations. Removed some unneeded calls to self.sa for exchange to .query() methods.
Marcin Kuzminski <marcin@python-works.com>
parents: 1343
diff changeset
34
3bce31f026b8 #47 implemented Adding of new repo_groups+forms+validators. Fixed sorting of repo groups by main names in multiple locations. Removed some unneeded calls to self.sa for exchange to .query() methods.
Marcin Kuzminski <marcin@python-works.com>
parents: 1343
diff changeset
35 c.repo_groups = [('', '')]
3bce31f026b8 #47 implemented Adding of new repo_groups+forms+validators. Fixed sorting of repo groups by main names in multiple locations. Removed some unneeded calls to self.sa for exchange to .query() methods.
Marcin Kuzminski <marcin@python-works.com>
parents: 1343
diff changeset
36 parents_link = lambda k: h.literal('&raquo;'.join(
3bce31f026b8 #47 implemented Adding of new repo_groups+forms+validators. Fixed sorting of repo groups by main names in multiple locations. Removed some unneeded calls to self.sa for exchange to .query() methods.
Marcin Kuzminski <marcin@python-works.com>
parents: 1343
diff changeset
37 map(lambda k: k.group_name,
3bce31f026b8 #47 implemented Adding of new repo_groups+forms+validators. Fixed sorting of repo groups by main names in multiple locations. Removed some unneeded calls to self.sa for exchange to .query() methods.
Marcin Kuzminski <marcin@python-works.com>
parents: 1343
diff changeset
38 k.parents + [k])
3bce31f026b8 #47 implemented Adding of new repo_groups+forms+validators. Fixed sorting of repo groups by main names in multiple locations. Removed some unneeded calls to self.sa for exchange to .query() methods.
Marcin Kuzminski <marcin@python-works.com>
parents: 1343
diff changeset
39 )
3bce31f026b8 #47 implemented Adding of new repo_groups+forms+validators. Fixed sorting of repo groups by main names in multiple locations. Removed some unneeded calls to self.sa for exchange to .query() methods.
Marcin Kuzminski <marcin@python-works.com>
parents: 1343
diff changeset
40 )
3bce31f026b8 #47 implemented Adding of new repo_groups+forms+validators. Fixed sorting of repo groups by main names in multiple locations. Removed some unneeded calls to self.sa for exchange to .query() methods.
Marcin Kuzminski <marcin@python-works.com>
parents: 1343
diff changeset
41
3bce31f026b8 #47 implemented Adding of new repo_groups+forms+validators. Fixed sorting of repo groups by main names in multiple locations. Removed some unneeded calls to self.sa for exchange to .query() methods.
Marcin Kuzminski <marcin@python-works.com>
parents: 1343
diff changeset
42 c.repo_groups.extend([(x.group_id, parents_link(x)) for \
3bce31f026b8 #47 implemented Adding of new repo_groups+forms+validators. Fixed sorting of repo groups by main names in multiple locations. Removed some unneeded calls to self.sa for exchange to .query() methods.
Marcin Kuzminski <marcin@python-works.com>
parents: 1343
diff changeset
43 x in self.sa.query(Group).all()])
3bce31f026b8 #47 implemented Adding of new repo_groups+forms+validators. Fixed sorting of repo groups by main names in multiple locations. Removed some unneeded calls to self.sa for exchange to .query() methods.
Marcin Kuzminski <marcin@python-works.com>
parents: 1343
diff changeset
44
3bce31f026b8 #47 implemented Adding of new repo_groups+forms+validators. Fixed sorting of repo groups by main names in multiple locations. Removed some unneeded calls to self.sa for exchange to .query() methods.
Marcin Kuzminski <marcin@python-works.com>
parents: 1343
diff changeset
45 c.repo_groups = sorted(c.repo_groups,
3bce31f026b8 #47 implemented Adding of new repo_groups+forms+validators. Fixed sorting of repo groups by main names in multiple locations. Removed some unneeded calls to self.sa for exchange to .query() methods.
Marcin Kuzminski <marcin@python-works.com>
parents: 1343
diff changeset
46 key=lambda t: t[1].split('&raquo;')[0])
3bce31f026b8 #47 implemented Adding of new repo_groups+forms+validators. Fixed sorting of repo groups by main names in multiple locations. Removed some unneeded calls to self.sa for exchange to .query() methods.
Marcin Kuzminski <marcin@python-works.com>
parents: 1343
diff changeset
47 c.repo_groups_choices = map(lambda k: unicode(k[0]), c.repo_groups)
3bce31f026b8 #47 implemented Adding of new repo_groups+forms+validators. Fixed sorting of repo groups by main names in multiple locations. Removed some unneeded calls to self.sa for exchange to .query() methods.
Marcin Kuzminski <marcin@python-works.com>
parents: 1343
diff changeset
48
1347
43b8e161be3f #47 implemented basic edition of groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1346
diff changeset
49 def __load_data(self, group_id):
43b8e161be3f #47 implemented basic edition of groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1346
diff changeset
50 """
43b8e161be3f #47 implemented basic edition of groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1346
diff changeset
51 Load defaults settings for edit, and update
43b8e161be3f #47 implemented basic edition of groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1346
diff changeset
52
43b8e161be3f #47 implemented basic edition of groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1346
diff changeset
53 :param group_id:
43b8e161be3f #47 implemented basic edition of groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1346
diff changeset
54 """
43b8e161be3f #47 implemented basic edition of groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1346
diff changeset
55 self.__load_defaults()
43b8e161be3f #47 implemented basic edition of groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1346
diff changeset
56
43b8e161be3f #47 implemented basic edition of groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1346
diff changeset
57 repo_group = Group.get(group_id)
43b8e161be3f #47 implemented basic edition of groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1346
diff changeset
58
1349
526120c77a38 #47 added editing of groups, and moving them between. Added check constraint for groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1347
diff changeset
59 data = repo_group.get_dict()
1347
43b8e161be3f #47 implemented basic edition of groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1346
diff changeset
60
1349
526120c77a38 #47 added editing of groups, and moving them between. Added check constraint for groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1347
diff changeset
61 return data
1345
3bce31f026b8 #47 implemented Adding of new repo_groups+forms+validators. Fixed sorting of repo groups by main names in multiple locations. Removed some unneeded calls to self.sa for exchange to .query() methods.
Marcin Kuzminski <marcin@python-works.com>
parents: 1343
diff changeset
62
3bce31f026b8 #47 implemented Adding of new repo_groups+forms+validators. Fixed sorting of repo groups by main names in multiple locations. Removed some unneeded calls to self.sa for exchange to .query() methods.
Marcin Kuzminski <marcin@python-works.com>
parents: 1343
diff changeset
63 @HasPermissionAnyDecorator('hg.admin')
1171
2ab211e0aecd changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
64 def index(self, format='html'):
2ab211e0aecd changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
65 """GET /repos_groups: All items in the collection"""
2ab211e0aecd changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
66 # url('repos_groups')
2ab211e0aecd changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
67
1345
3bce31f026b8 #47 implemented Adding of new repo_groups+forms+validators. Fixed sorting of repo groups by main names in multiple locations. Removed some unneeded calls to self.sa for exchange to .query() methods.
Marcin Kuzminski <marcin@python-works.com>
parents: 1343
diff changeset
68 sk = lambda g:g.parents[0].group_name if g.parents else g.group_name
3bce31f026b8 #47 implemented Adding of new repo_groups+forms+validators. Fixed sorting of repo groups by main names in multiple locations. Removed some unneeded calls to self.sa for exchange to .query() methods.
Marcin Kuzminski <marcin@python-works.com>
parents: 1343
diff changeset
69 c.groups = sorted(Group.query().all(), key=sk)
3bce31f026b8 #47 implemented Adding of new repo_groups+forms+validators. Fixed sorting of repo groups by main names in multiple locations. Removed some unneeded calls to self.sa for exchange to .query() methods.
Marcin Kuzminski <marcin@python-works.com>
parents: 1343
diff changeset
70 return render('admin/repos_groups/repos_groups_show.html')
3bce31f026b8 #47 implemented Adding of new repo_groups+forms+validators. Fixed sorting of repo groups by main names in multiple locations. Removed some unneeded calls to self.sa for exchange to .query() methods.
Marcin Kuzminski <marcin@python-works.com>
parents: 1343
diff changeset
71
3bce31f026b8 #47 implemented Adding of new repo_groups+forms+validators. Fixed sorting of repo groups by main names in multiple locations. Removed some unneeded calls to self.sa for exchange to .query() methods.
Marcin Kuzminski <marcin@python-works.com>
parents: 1343
diff changeset
72 @HasPermissionAnyDecorator('hg.admin')
1171
2ab211e0aecd changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
73 def create(self):
2ab211e0aecd changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
74 """POST /repos_groups: Create a new item"""
2ab211e0aecd changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
75 # url('repos_groups')
1345
3bce31f026b8 #47 implemented Adding of new repo_groups+forms+validators. Fixed sorting of repo groups by main names in multiple locations. Removed some unneeded calls to self.sa for exchange to .query() methods.
Marcin Kuzminski <marcin@python-works.com>
parents: 1343
diff changeset
76 self.__load_defaults()
3bce31f026b8 #47 implemented Adding of new repo_groups+forms+validators. Fixed sorting of repo groups by main names in multiple locations. Removed some unneeded calls to self.sa for exchange to .query() methods.
Marcin Kuzminski <marcin@python-works.com>
parents: 1343
diff changeset
77 repos_group_model = ReposGroupModel()
3bce31f026b8 #47 implemented Adding of new repo_groups+forms+validators. Fixed sorting of repo groups by main names in multiple locations. Removed some unneeded calls to self.sa for exchange to .query() methods.
Marcin Kuzminski <marcin@python-works.com>
parents: 1343
diff changeset
78 repos_group_form = ReposGroupForm(available_groups=
3bce31f026b8 #47 implemented Adding of new repo_groups+forms+validators. Fixed sorting of repo groups by main names in multiple locations. Removed some unneeded calls to self.sa for exchange to .query() methods.
Marcin Kuzminski <marcin@python-works.com>
parents: 1343
diff changeset
79 c.repo_groups_choices)()
3bce31f026b8 #47 implemented Adding of new repo_groups+forms+validators. Fixed sorting of repo groups by main names in multiple locations. Removed some unneeded calls to self.sa for exchange to .query() methods.
Marcin Kuzminski <marcin@python-works.com>
parents: 1343
diff changeset
80 try:
3bce31f026b8 #47 implemented Adding of new repo_groups+forms+validators. Fixed sorting of repo groups by main names in multiple locations. Removed some unneeded calls to self.sa for exchange to .query() methods.
Marcin Kuzminski <marcin@python-works.com>
parents: 1343
diff changeset
81 form_result = repos_group_form.to_python(dict(request.POST))
3bce31f026b8 #47 implemented Adding of new repo_groups+forms+validators. Fixed sorting of repo groups by main names in multiple locations. Removed some unneeded calls to self.sa for exchange to .query() methods.
Marcin Kuzminski <marcin@python-works.com>
parents: 1343
diff changeset
82 repos_group_model.create(form_result)
3bce31f026b8 #47 implemented Adding of new repo_groups+forms+validators. Fixed sorting of repo groups by main names in multiple locations. Removed some unneeded calls to self.sa for exchange to .query() methods.
Marcin Kuzminski <marcin@python-works.com>
parents: 1343
diff changeset
83 h.flash(_('created repos group %s') \
1347
43b8e161be3f #47 implemented basic edition of groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1346
diff changeset
84 % form_result['group_name'], category='success')
1345
3bce31f026b8 #47 implemented Adding of new repo_groups+forms+validators. Fixed sorting of repo groups by main names in multiple locations. Removed some unneeded calls to self.sa for exchange to .query() methods.
Marcin Kuzminski <marcin@python-works.com>
parents: 1343
diff changeset
85 #TODO: in futureaction_logger(, '', '', '', self.sa)
3bce31f026b8 #47 implemented Adding of new repo_groups+forms+validators. Fixed sorting of repo groups by main names in multiple locations. Removed some unneeded calls to self.sa for exchange to .query() methods.
Marcin Kuzminski <marcin@python-works.com>
parents: 1343
diff changeset
86 except formencode.Invalid, errors:
1171
2ab211e0aecd changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
87
1345
3bce31f026b8 #47 implemented Adding of new repo_groups+forms+validators. Fixed sorting of repo groups by main names in multiple locations. Removed some unneeded calls to self.sa for exchange to .query() methods.
Marcin Kuzminski <marcin@python-works.com>
parents: 1343
diff changeset
88 return htmlfill.render(
3bce31f026b8 #47 implemented Adding of new repo_groups+forms+validators. Fixed sorting of repo groups by main names in multiple locations. Removed some unneeded calls to self.sa for exchange to .query() methods.
Marcin Kuzminski <marcin@python-works.com>
parents: 1343
diff changeset
89 render('admin/repos_groups/repos_groups_add.html'),
3bce31f026b8 #47 implemented Adding of new repo_groups+forms+validators. Fixed sorting of repo groups by main names in multiple locations. Removed some unneeded calls to self.sa for exchange to .query() methods.
Marcin Kuzminski <marcin@python-works.com>
parents: 1343
diff changeset
90 defaults=errors.value,
3bce31f026b8 #47 implemented Adding of new repo_groups+forms+validators. Fixed sorting of repo groups by main names in multiple locations. Removed some unneeded calls to self.sa for exchange to .query() methods.
Marcin Kuzminski <marcin@python-works.com>
parents: 1343
diff changeset
91 errors=errors.error_dict or {},
3bce31f026b8 #47 implemented Adding of new repo_groups+forms+validators. Fixed sorting of repo groups by main names in multiple locations. Removed some unneeded calls to self.sa for exchange to .query() methods.
Marcin Kuzminski <marcin@python-works.com>
parents: 1343
diff changeset
92 prefix_error=False,
3bce31f026b8 #47 implemented Adding of new repo_groups+forms+validators. Fixed sorting of repo groups by main names in multiple locations. Removed some unneeded calls to self.sa for exchange to .query() methods.
Marcin Kuzminski <marcin@python-works.com>
parents: 1343
diff changeset
93 encoding="UTF-8")
3bce31f026b8 #47 implemented Adding of new repo_groups+forms+validators. Fixed sorting of repo groups by main names in multiple locations. Removed some unneeded calls to self.sa for exchange to .query() methods.
Marcin Kuzminski <marcin@python-works.com>
parents: 1343
diff changeset
94 except Exception:
3bce31f026b8 #47 implemented Adding of new repo_groups+forms+validators. Fixed sorting of repo groups by main names in multiple locations. Removed some unneeded calls to self.sa for exchange to .query() methods.
Marcin Kuzminski <marcin@python-works.com>
parents: 1343
diff changeset
95 log.error(traceback.format_exc())
3bce31f026b8 #47 implemented Adding of new repo_groups+forms+validators. Fixed sorting of repo groups by main names in multiple locations. Removed some unneeded calls to self.sa for exchange to .query() methods.
Marcin Kuzminski <marcin@python-works.com>
parents: 1343
diff changeset
96 h.flash(_('error occurred during creation of repos group %s') \
1347
43b8e161be3f #47 implemented basic edition of groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1346
diff changeset
97 % request.POST.get('group_name'), category='error')
1345
3bce31f026b8 #47 implemented Adding of new repo_groups+forms+validators. Fixed sorting of repo groups by main names in multiple locations. Removed some unneeded calls to self.sa for exchange to .query() methods.
Marcin Kuzminski <marcin@python-works.com>
parents: 1343
diff changeset
98
3bce31f026b8 #47 implemented Adding of new repo_groups+forms+validators. Fixed sorting of repo groups by main names in multiple locations. Removed some unneeded calls to self.sa for exchange to .query() methods.
Marcin Kuzminski <marcin@python-works.com>
parents: 1343
diff changeset
99 return redirect(url('repos_groups'))
3bce31f026b8 #47 implemented Adding of new repo_groups+forms+validators. Fixed sorting of repo groups by main names in multiple locations. Removed some unneeded calls to self.sa for exchange to .query() methods.
Marcin Kuzminski <marcin@python-works.com>
parents: 1343
diff changeset
100
3bce31f026b8 #47 implemented Adding of new repo_groups+forms+validators. Fixed sorting of repo groups by main names in multiple locations. Removed some unneeded calls to self.sa for exchange to .query() methods.
Marcin Kuzminski <marcin@python-works.com>
parents: 1343
diff changeset
101
3bce31f026b8 #47 implemented Adding of new repo_groups+forms+validators. Fixed sorting of repo groups by main names in multiple locations. Removed some unneeded calls to self.sa for exchange to .query() methods.
Marcin Kuzminski <marcin@python-works.com>
parents: 1343
diff changeset
102 @HasPermissionAnyDecorator('hg.admin')
1171
2ab211e0aecd changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
103 def new(self, format='html'):
2ab211e0aecd changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
104 """GET /repos_groups/new: Form to create a new item"""
2ab211e0aecd changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
105 # url('new_repos_group')
1345
3bce31f026b8 #47 implemented Adding of new repo_groups+forms+validators. Fixed sorting of repo groups by main names in multiple locations. Removed some unneeded calls to self.sa for exchange to .query() methods.
Marcin Kuzminski <marcin@python-works.com>
parents: 1343
diff changeset
106 self.__load_defaults()
3bce31f026b8 #47 implemented Adding of new repo_groups+forms+validators. Fixed sorting of repo groups by main names in multiple locations. Removed some unneeded calls to self.sa for exchange to .query() methods.
Marcin Kuzminski <marcin@python-works.com>
parents: 1343
diff changeset
107 return render('admin/repos_groups/repos_groups_add.html')
1171
2ab211e0aecd changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
108
1345
3bce31f026b8 #47 implemented Adding of new repo_groups+forms+validators. Fixed sorting of repo groups by main names in multiple locations. Removed some unneeded calls to self.sa for exchange to .query() methods.
Marcin Kuzminski <marcin@python-works.com>
parents: 1343
diff changeset
109 @HasPermissionAnyDecorator('hg.admin')
1171
2ab211e0aecd changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
110 def update(self, id):
2ab211e0aecd changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
111 """PUT /repos_groups/id: Update an existing item"""
2ab211e0aecd changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
112 # Forms posted to this method should contain a hidden field:
2ab211e0aecd changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
113 # <input type="hidden" name="_method" value="PUT" />
2ab211e0aecd changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
114 # Or using helpers:
2ab211e0aecd changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
115 # h.form(url('repos_group', id=ID),
2ab211e0aecd changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
116 # method='put')
2ab211e0aecd changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
117 # url('repos_group', id=ID)
2ab211e0aecd changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
118
1347
43b8e161be3f #47 implemented basic edition of groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1346
diff changeset
119 self.__load_defaults()
43b8e161be3f #47 implemented basic edition of groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1346
diff changeset
120 c.repos_group = Group.get(id)
43b8e161be3f #47 implemented basic edition of groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1346
diff changeset
121
43b8e161be3f #47 implemented basic edition of groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1346
diff changeset
122 repos_group_model = ReposGroupModel()
43b8e161be3f #47 implemented basic edition of groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1346
diff changeset
123 repos_group_form = ReposGroupForm(edit=True,
43b8e161be3f #47 implemented basic edition of groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1346
diff changeset
124 old_data=c.repos_group.get_dict(),
43b8e161be3f #47 implemented basic edition of groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1346
diff changeset
125 available_groups=
43b8e161be3f #47 implemented basic edition of groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1346
diff changeset
126 c.repo_groups_choices)()
43b8e161be3f #47 implemented basic edition of groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1346
diff changeset
127 try:
43b8e161be3f #47 implemented basic edition of groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1346
diff changeset
128 form_result = repos_group_form.to_python(dict(request.POST))
43b8e161be3f #47 implemented basic edition of groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1346
diff changeset
129 repos_group_model.update(id, form_result)
43b8e161be3f #47 implemented basic edition of groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1346
diff changeset
130 h.flash(_('updated repos group %s') \
43b8e161be3f #47 implemented basic edition of groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1346
diff changeset
131 % form_result['group_name'], category='success')
43b8e161be3f #47 implemented basic edition of groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1346
diff changeset
132 #TODO: in futureaction_logger(, '', '', '', self.sa)
43b8e161be3f #47 implemented basic edition of groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1346
diff changeset
133 except formencode.Invalid, errors:
43b8e161be3f #47 implemented basic edition of groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1346
diff changeset
134
43b8e161be3f #47 implemented basic edition of groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1346
diff changeset
135 return htmlfill.render(
43b8e161be3f #47 implemented basic edition of groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1346
diff changeset
136 render('admin/repos_groups/repos_groups_edit.html'),
43b8e161be3f #47 implemented basic edition of groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1346
diff changeset
137 defaults=errors.value,
43b8e161be3f #47 implemented basic edition of groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1346
diff changeset
138 errors=errors.error_dict or {},
43b8e161be3f #47 implemented basic edition of groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1346
diff changeset
139 prefix_error=False,
43b8e161be3f #47 implemented basic edition of groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1346
diff changeset
140 encoding="UTF-8")
43b8e161be3f #47 implemented basic edition of groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1346
diff changeset
141 except Exception:
43b8e161be3f #47 implemented basic edition of groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1346
diff changeset
142 log.error(traceback.format_exc())
1349
526120c77a38 #47 added editing of groups, and moving them between. Added check constraint for groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1347
diff changeset
143 h.flash(_('error occurred during update of repos group %s') \
1347
43b8e161be3f #47 implemented basic edition of groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1346
diff changeset
144 % request.POST.get('group_name'), category='error')
43b8e161be3f #47 implemented basic edition of groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1346
diff changeset
145
43b8e161be3f #47 implemented basic edition of groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1346
diff changeset
146 return redirect(url('repos_groups'))
43b8e161be3f #47 implemented basic edition of groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1346
diff changeset
147
43b8e161be3f #47 implemented basic edition of groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1346
diff changeset
148
1345
3bce31f026b8 #47 implemented Adding of new repo_groups+forms+validators. Fixed sorting of repo groups by main names in multiple locations. Removed some unneeded calls to self.sa for exchange to .query() methods.
Marcin Kuzminski <marcin@python-works.com>
parents: 1343
diff changeset
149 @HasPermissionAnyDecorator('hg.admin')
1171
2ab211e0aecd changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
150 def delete(self, id):
2ab211e0aecd changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
151 """DELETE /repos_groups/id: Delete an existing item"""
2ab211e0aecd changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
152 # Forms posted to this method should contain a hidden field:
2ab211e0aecd changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
153 # <input type="hidden" name="_method" value="DELETE" />
2ab211e0aecd changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
154 # Or using helpers:
2ab211e0aecd changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
155 # h.form(url('repos_group', id=ID),
2ab211e0aecd changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
156 # method='delete')
2ab211e0aecd changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
157 # url('repos_group', id=ID)
2ab211e0aecd changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
158
1346
cf78d302d441 #47 implemented deleting of empty groups. Fixed problem with full paths on nested groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1345
diff changeset
159 repos_group_model = ReposGroupModel()
cf78d302d441 #47 implemented deleting of empty groups. Fixed problem with full paths on nested groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1345
diff changeset
160 gr = Group.get(id)
cf78d302d441 #47 implemented deleting of empty groups. Fixed problem with full paths on nested groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1345
diff changeset
161 repos = gr.repositories.all()
cf78d302d441 #47 implemented deleting of empty groups. Fixed problem with full paths on nested groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1345
diff changeset
162 if repos:
cf78d302d441 #47 implemented deleting of empty groups. Fixed problem with full paths on nested groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1345
diff changeset
163 h.flash(_('This group contains %s repositores and cannot be '
cf78d302d441 #47 implemented deleting of empty groups. Fixed problem with full paths on nested groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1345
diff changeset
164 'deleted' % len(repos)),
cf78d302d441 #47 implemented deleting of empty groups. Fixed problem with full paths on nested groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1345
diff changeset
165 category='error')
cf78d302d441 #47 implemented deleting of empty groups. Fixed problem with full paths on nested groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1345
diff changeset
166 return redirect(url('repos_groups'))
cf78d302d441 #47 implemented deleting of empty groups. Fixed problem with full paths on nested groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1345
diff changeset
167
cf78d302d441 #47 implemented deleting of empty groups. Fixed problem with full paths on nested groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1345
diff changeset
168
cf78d302d441 #47 implemented deleting of empty groups. Fixed problem with full paths on nested groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1345
diff changeset
169 try:
cf78d302d441 #47 implemented deleting of empty groups. Fixed problem with full paths on nested groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1345
diff changeset
170 repos_group_model.delete(id)
cf78d302d441 #47 implemented deleting of empty groups. Fixed problem with full paths on nested groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1345
diff changeset
171 h.flash(_('removed repos group %s' % gr.group_name), category='success')
cf78d302d441 #47 implemented deleting of empty groups. Fixed problem with full paths on nested groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1345
diff changeset
172 #TODO: in futureaction_logger(, '', '', '', self.sa)
cf78d302d441 #47 implemented deleting of empty groups. Fixed problem with full paths on nested groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1345
diff changeset
173 except Exception:
cf78d302d441 #47 implemented deleting of empty groups. Fixed problem with full paths on nested groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1345
diff changeset
174 log.error(traceback.format_exc())
cf78d302d441 #47 implemented deleting of empty groups. Fixed problem with full paths on nested groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1345
diff changeset
175 h.flash(_('error occurred during deletion of repos group %s' % gr.group_name),
cf78d302d441 #47 implemented deleting of empty groups. Fixed problem with full paths on nested groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1345
diff changeset
176 category='error')
cf78d302d441 #47 implemented deleting of empty groups. Fixed problem with full paths on nested groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1345
diff changeset
177
cf78d302d441 #47 implemented deleting of empty groups. Fixed problem with full paths on nested groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1345
diff changeset
178 return redirect(url('repos_groups'))
cf78d302d441 #47 implemented deleting of empty groups. Fixed problem with full paths on nested groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1345
diff changeset
179
1171
2ab211e0aecd changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
180 def show(self, id, format='html'):
2ab211e0aecd changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
181 """GET /repos_groups/id: Show a specific item"""
2ab211e0aecd changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
182 # url('repos_group', id=ID)
2ab211e0aecd changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
183
1193
523382549c45 Added repo group page showing what reposiories are inside a group
Marcin Kuzminski <marcin@python-works.com>
parents: 1171
diff changeset
184 c.group = Group.get(id)
523382549c45 Added repo group page showing what reposiories are inside a group
Marcin Kuzminski <marcin@python-works.com>
parents: 1171
diff changeset
185 if c.group:
1343
a04fe5986109 #47 implemented basic gui for browsing repo groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1245
diff changeset
186 c.group_repos = c.group.repositories.all()
1193
523382549c45 Added repo group page showing what reposiories are inside a group
Marcin Kuzminski <marcin@python-works.com>
parents: 1171
diff changeset
187 else:
523382549c45 Added repo group page showing what reposiories are inside a group
Marcin Kuzminski <marcin@python-works.com>
parents: 1171
diff changeset
188 return redirect(url('repos_group'))
523382549c45 Added repo group page showing what reposiories are inside a group
Marcin Kuzminski <marcin@python-works.com>
parents: 1171
diff changeset
189
523382549c45 Added repo group page showing what reposiories are inside a group
Marcin Kuzminski <marcin@python-works.com>
parents: 1171
diff changeset
190 sortables = ['name', 'description', 'last_change', 'tip', 'owner']
523382549c45 Added repo group page showing what reposiories are inside a group
Marcin Kuzminski <marcin@python-works.com>
parents: 1171
diff changeset
191 current_sort = request.GET.get('sort', 'name')
523382549c45 Added repo group page showing what reposiories are inside a group
Marcin Kuzminski <marcin@python-works.com>
parents: 1171
diff changeset
192 current_sort_slug = current_sort.replace('-', '')
523382549c45 Added repo group page showing what reposiories are inside a group
Marcin Kuzminski <marcin@python-works.com>
parents: 1171
diff changeset
193
523382549c45 Added repo group page showing what reposiories are inside a group
Marcin Kuzminski <marcin@python-works.com>
parents: 1171
diff changeset
194 if current_sort_slug not in sortables:
523382549c45 Added repo group page showing what reposiories are inside a group
Marcin Kuzminski <marcin@python-works.com>
parents: 1171
diff changeset
195 c.sort_by = 'name'
523382549c45 Added repo group page showing what reposiories are inside a group
Marcin Kuzminski <marcin@python-works.com>
parents: 1171
diff changeset
196 current_sort_slug = c.sort_by
523382549c45 Added repo group page showing what reposiories are inside a group
Marcin Kuzminski <marcin@python-works.com>
parents: 1171
diff changeset
197 else:
523382549c45 Added repo group page showing what reposiories are inside a group
Marcin Kuzminski <marcin@python-works.com>
parents: 1171
diff changeset
198 c.sort_by = current_sort
523382549c45 Added repo group page showing what reposiories are inside a group
Marcin Kuzminski <marcin@python-works.com>
parents: 1171
diff changeset
199 c.sort_slug = current_sort_slug
523382549c45 Added repo group page showing what reposiories are inside a group
Marcin Kuzminski <marcin@python-works.com>
parents: 1171
diff changeset
200
523382549c45 Added repo group page showing what reposiories are inside a group
Marcin Kuzminski <marcin@python-works.com>
parents: 1171
diff changeset
201 sort_key = current_sort_slug + '_sort'
523382549c45 Added repo group page showing what reposiories are inside a group
Marcin Kuzminski <marcin@python-works.com>
parents: 1171
diff changeset
202
523382549c45 Added repo group page showing what reposiories are inside a group
Marcin Kuzminski <marcin@python-works.com>
parents: 1171
diff changeset
203 #overwrite our cached list with current filter
523382549c45 Added repo group page showing what reposiories are inside a group
Marcin Kuzminski <marcin@python-works.com>
parents: 1171
diff changeset
204 gr_filter = [r.repo_name for r in c.group_repos]
523382549c45 Added repo group page showing what reposiories are inside a group
Marcin Kuzminski <marcin@python-works.com>
parents: 1171
diff changeset
205 c.cached_repo_list = self.scm_model.get_repos(all_repos=gr_filter)
523382549c45 Added repo group page showing what reposiories are inside a group
Marcin Kuzminski <marcin@python-works.com>
parents: 1171
diff changeset
206
523382549c45 Added repo group page showing what reposiories are inside a group
Marcin Kuzminski <marcin@python-works.com>
parents: 1171
diff changeset
207 if c.sort_by.startswith('-'):
523382549c45 Added repo group page showing what reposiories are inside a group
Marcin Kuzminski <marcin@python-works.com>
parents: 1171
diff changeset
208 c.repos_list = sorted(c.cached_repo_list, key=itemgetter(sort_key),
523382549c45 Added repo group page showing what reposiories are inside a group
Marcin Kuzminski <marcin@python-works.com>
parents: 1171
diff changeset
209 reverse=True)
523382549c45 Added repo group page showing what reposiories are inside a group
Marcin Kuzminski <marcin@python-works.com>
parents: 1171
diff changeset
210 else:
523382549c45 Added repo group page showing what reposiories are inside a group
Marcin Kuzminski <marcin@python-works.com>
parents: 1171
diff changeset
211 c.repos_list = sorted(c.cached_repo_list, key=itemgetter(sort_key),
523382549c45 Added repo group page showing what reposiories are inside a group
Marcin Kuzminski <marcin@python-works.com>
parents: 1171
diff changeset
212 reverse=False)
523382549c45 Added repo group page showing what reposiories are inside a group
Marcin Kuzminski <marcin@python-works.com>
parents: 1171
diff changeset
213
523382549c45 Added repo group page showing what reposiories are inside a group
Marcin Kuzminski <marcin@python-works.com>
parents: 1171
diff changeset
214 c.repo_cnt = len(c.repos_list)
523382549c45 Added repo group page showing what reposiories are inside a group
Marcin Kuzminski <marcin@python-works.com>
parents: 1171
diff changeset
215
1343
a04fe5986109 #47 implemented basic gui for browsing repo groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1245
diff changeset
216
a04fe5986109 #47 implemented basic gui for browsing repo groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1245
diff changeset
217 c.groups = self.sa.query(Group).order_by(Group.group_name)\
a04fe5986109 #47 implemented basic gui for browsing repo groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1245
diff changeset
218 .filter(Group.group_parent_id == id).all()
a04fe5986109 #47 implemented basic gui for browsing repo groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1245
diff changeset
219
1193
523382549c45 Added repo group page showing what reposiories are inside a group
Marcin Kuzminski <marcin@python-works.com>
parents: 1171
diff changeset
220 return render('admin/repos_groups/repos_groups.html')
523382549c45 Added repo group page showing what reposiories are inside a group
Marcin Kuzminski <marcin@python-works.com>
parents: 1171
diff changeset
221
1345
3bce31f026b8 #47 implemented Adding of new repo_groups+forms+validators. Fixed sorting of repo groups by main names in multiple locations. Removed some unneeded calls to self.sa for exchange to .query() methods.
Marcin Kuzminski <marcin@python-works.com>
parents: 1343
diff changeset
222 @HasPermissionAnyDecorator('hg.admin')
1171
2ab211e0aecd changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
223 def edit(self, id, format='html'):
2ab211e0aecd changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
224 """GET /repos_groups/id/edit: Form to edit an existing item"""
2ab211e0aecd changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
225 # url('edit_repos_group', id=ID)
1349
526120c77a38 #47 added editing of groups, and moving them between. Added check constraint for groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1347
diff changeset
226
526120c77a38 #47 added editing of groups, and moving them between. Added check constraint for groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1347
diff changeset
227 id = int(id)
526120c77a38 #47 added editing of groups, and moving them between. Added check constraint for groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1347
diff changeset
228
1347
43b8e161be3f #47 implemented basic edition of groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1346
diff changeset
229 c.repos_group = Group.get(id)
43b8e161be3f #47 implemented basic edition of groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1346
diff changeset
230 defaults = self.__load_data(id)
43b8e161be3f #47 implemented basic edition of groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1346
diff changeset
231
1349
526120c77a38 #47 added editing of groups, and moving them between. Added check constraint for groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1347
diff changeset
232 # we need to exclude this group from the group list for editing
526120c77a38 #47 added editing of groups, and moving them between. Added check constraint for groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1347
diff changeset
233 c.repo_groups = filter(lambda x:x[0] != id, c.repo_groups)
526120c77a38 #47 added editing of groups, and moving them between. Added check constraint for groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1347
diff changeset
234
1347
43b8e161be3f #47 implemented basic edition of groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1346
diff changeset
235 return htmlfill.render(
43b8e161be3f #47 implemented basic edition of groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1346
diff changeset
236 render('admin/repos_groups/repos_groups_edit.html'),
43b8e161be3f #47 implemented basic edition of groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1346
diff changeset
237 defaults=defaults,
43b8e161be3f #47 implemented basic edition of groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1346
diff changeset
238 encoding="UTF-8",
43b8e161be3f #47 implemented basic edition of groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1346
diff changeset
239 force_defaults=False
43b8e161be3f #47 implemented basic edition of groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1346
diff changeset
240 )
43b8e161be3f #47 implemented basic edition of groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1346
diff changeset
241
43b8e161be3f #47 implemented basic edition of groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1346
diff changeset
242