annotate rhodecode/controllers/admin/repos_groups.py @ 1543:ada6926c374f beta

Added friendly message about removing a group that still contains subgroups. Fixed option to remove a group that is not in filesystem (ex. someone deleted it intentionally on filesystem) in this case RhodeCode will simply just throw an error message saying this group cannot be deleted.
author Marcin Kuzminski <marcin@python-works.com>
date Tue, 11 Oct 2011 08:02:51 +0200
parents 27be8f94c207
children fbc762ae3496
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
1543
ada6926c374f Added friendly message about removing a group that still contains subgroups.
Marcin Kuzminski <marcin@python-works.com>
parents: 1538
diff changeset
12 from sqlalchemy.exc import IntegrityError
ada6926c374f Added friendly message about removing a group that still contains subgroups.
Marcin Kuzminski <marcin@python-works.com>
parents: 1538
diff changeset
13
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
14 from rhodecode.lib import helpers as h
1543
ada6926c374f Added friendly message about removing a group that still contains subgroups.
Marcin Kuzminski <marcin@python-works.com>
parents: 1538
diff changeset
15 from rhodecode.lib.auth import LoginRequired, HasPermissionAnyDecorator
1171
2ab211e0aecd changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
16 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
17 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
18 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
19 from rhodecode.model.forms import ReposGroupForm
1171
2ab211e0aecd changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
20
2ab211e0aecd changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
21 log = logging.getLogger(__name__)
2ab211e0aecd changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
22
1245
5f2fbab7c429 PEP8ify - controllers
Marcin Kuzminski <marcin@python-works.com>
parents: 1193
diff changeset
23
1171
2ab211e0aecd changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
24 class ReposGroupsController(BaseController):
2ab211e0aecd changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
25 """REST Controller styled on the Atom Publishing Protocol"""
2ab211e0aecd changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
26 # To properly map this controller, ensure your config/routing.py
2ab211e0aecd changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
27 # file has a resource setup:
2ab211e0aecd changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
28 # map.resource('repos_group', 'repos_groups')
2ab211e0aecd changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
29
1347
43b8e161be3f #47 implemented basic edition of groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1346
diff changeset
30 @LoginRequired()
43b8e161be3f #47 implemented basic edition of groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1346
diff changeset
31 def __before__(self):
43b8e161be3f #47 implemented basic edition of groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1346
diff changeset
32 super(ReposGroupsController, self).__before__()
43b8e161be3f #47 implemented basic edition of groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1346
diff changeset
33
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
34 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
35
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 c.repo_groups = [('', '')]
1538
27be8f94c207 implements #226 repo groups available by path
Marcin Kuzminski <marcin@python-works.com>
parents: 1482
diff changeset
37 parents_link = lambda k: h.literal('&raquo;'.join(k))
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
38
1538
27be8f94c207 implements #226 repo groups available by path
Marcin Kuzminski <marcin@python-works.com>
parents: 1482
diff changeset
39 c.repo_groups.extend([(x.group_id, parents_link(x.full_path_splitted))
27be8f94c207 implements #226 repo groups available by path
Marcin Kuzminski <marcin@python-works.com>
parents: 1482
diff changeset
40 for x in self.sa.query(Group).all()])
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
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 = 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
43 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
44 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
45
1347
43b8e161be3f #47 implemented basic edition of groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1346
diff changeset
46 def __load_data(self, group_id):
43b8e161be3f #47 implemented basic edition of groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1346
diff changeset
47 """
43b8e161be3f #47 implemented basic edition of groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1346
diff changeset
48 Load defaults settings for edit, and update
43b8e161be3f #47 implemented basic edition of groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1346
diff changeset
49
43b8e161be3f #47 implemented basic edition of groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1346
diff changeset
50 :param group_id:
43b8e161be3f #47 implemented basic edition of groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1346
diff changeset
51 """
43b8e161be3f #47 implemented basic edition of groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1346
diff changeset
52 self.__load_defaults()
43b8e161be3f #47 implemented basic edition of groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1346
diff changeset
53
43b8e161be3f #47 implemented basic edition of groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1346
diff changeset
54 repo_group = Group.get(group_id)
43b8e161be3f #47 implemented basic edition of groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1346
diff changeset
55
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
56 data = repo_group.get_dict()
1347
43b8e161be3f #47 implemented basic edition of groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1346
diff changeset
57
1538
27be8f94c207 implements #226 repo groups available by path
Marcin Kuzminski <marcin@python-works.com>
parents: 1482
diff changeset
58 data['group_name'] = repo_group.name
27be8f94c207 implements #226 repo groups available by path
Marcin Kuzminski <marcin@python-works.com>
parents: 1482
diff changeset
59
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
60 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
61
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 @HasPermissionAnyDecorator('hg.admin')
1171
2ab211e0aecd changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
63 def index(self, format='html'):
2ab211e0aecd changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
64 """GET /repos_groups: All items in the collection"""
2ab211e0aecd changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
65 # url('repos_groups')
2ab211e0aecd changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
66
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
67 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
68 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
69 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
70
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 @HasPermissionAnyDecorator('hg.admin')
1171
2ab211e0aecd changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
72 def create(self):
2ab211e0aecd changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
73 """POST /repos_groups: Create a new item"""
2ab211e0aecd changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
74 # 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
75 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
76 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
77 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
78 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
79 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
80 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
81 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
82 h.flash(_('created repos group %s') \
1347
43b8e161be3f #47 implemented basic edition of groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1346
diff changeset
83 % 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
84 #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
85 except formencode.Invalid, errors:
1171
2ab211e0aecd changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
86
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
87 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
88 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
89 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
90 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
91 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
92 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
93 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
94 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
95 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
96 % 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
97
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 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
99
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 @HasPermissionAnyDecorator('hg.admin')
1171
2ab211e0aecd changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
102 def new(self, format='html'):
2ab211e0aecd changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
103 """GET /repos_groups/new: Form to create a new item"""
2ab211e0aecd changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
104 # 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
105 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
106 return render('admin/repos_groups/repos_groups_add.html')
1171
2ab211e0aecd changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
107
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
108 @HasPermissionAnyDecorator('hg.admin')
1171
2ab211e0aecd changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
109 def update(self, id):
2ab211e0aecd changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
110 """PUT /repos_groups/id: Update an existing item"""
2ab211e0aecd changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
111 # Forms posted to this method should contain a hidden field:
2ab211e0aecd changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
112 # <input type="hidden" name="_method" value="PUT" />
2ab211e0aecd changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
113 # Or using helpers:
2ab211e0aecd changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
114 # h.form(url('repos_group', id=ID),
2ab211e0aecd changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
115 # method='put')
2ab211e0aecd changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
116 # url('repos_group', id=ID)
2ab211e0aecd changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
117
1347
43b8e161be3f #47 implemented basic edition of groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1346
diff changeset
118 self.__load_defaults()
43b8e161be3f #47 implemented basic edition of groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1346
diff changeset
119 c.repos_group = Group.get(id)
43b8e161be3f #47 implemented basic edition of groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1346
diff changeset
120
43b8e161be3f #47 implemented basic edition of groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1346
diff changeset
121 repos_group_model = ReposGroupModel()
43b8e161be3f #47 implemented basic edition of groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1346
diff changeset
122 repos_group_form = ReposGroupForm(edit=True,
43b8e161be3f #47 implemented basic edition of groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1346
diff changeset
123 old_data=c.repos_group.get_dict(),
43b8e161be3f #47 implemented basic edition of groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1346
diff changeset
124 available_groups=
43b8e161be3f #47 implemented basic edition of groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1346
diff changeset
125 c.repo_groups_choices)()
43b8e161be3f #47 implemented basic edition of groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1346
diff changeset
126 try:
43b8e161be3f #47 implemented basic edition of groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1346
diff changeset
127 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
128 repos_group_model.update(id, form_result)
43b8e161be3f #47 implemented basic edition of groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1346
diff changeset
129 h.flash(_('updated repos group %s') \
43b8e161be3f #47 implemented basic edition of groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1346
diff changeset
130 % form_result['group_name'], category='success')
43b8e161be3f #47 implemented basic edition of groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1346
diff changeset
131 #TODO: in futureaction_logger(, '', '', '', self.sa)
43b8e161be3f #47 implemented basic edition of groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1346
diff changeset
132 except formencode.Invalid, errors:
43b8e161be3f #47 implemented basic edition of groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1346
diff changeset
133
43b8e161be3f #47 implemented basic edition of groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1346
diff changeset
134 return htmlfill.render(
43b8e161be3f #47 implemented basic edition of groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1346
diff changeset
135 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
136 defaults=errors.value,
43b8e161be3f #47 implemented basic edition of groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1346
diff changeset
137 errors=errors.error_dict or {},
43b8e161be3f #47 implemented basic edition of groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1346
diff changeset
138 prefix_error=False,
43b8e161be3f #47 implemented basic edition of groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1346
diff changeset
139 encoding="UTF-8")
43b8e161be3f #47 implemented basic edition of groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1346
diff changeset
140 except Exception:
43b8e161be3f #47 implemented basic edition of groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1346
diff changeset
141 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
142 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
143 % request.POST.get('group_name'), category='error')
43b8e161be3f #47 implemented basic edition of groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1346
diff changeset
144
43b8e161be3f #47 implemented basic edition of groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1346
diff changeset
145 return redirect(url('repos_groups'))
43b8e161be3f #47 implemented basic edition of groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1346
diff changeset
146
43b8e161be3f #47 implemented basic edition of groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1346
diff changeset
147
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
148 @HasPermissionAnyDecorator('hg.admin')
1171
2ab211e0aecd changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
149 def delete(self, id):
2ab211e0aecd changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
150 """DELETE /repos_groups/id: Delete an existing item"""
2ab211e0aecd changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
151 # Forms posted to this method should contain a hidden field:
2ab211e0aecd changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
152 # <input type="hidden" name="_method" value="DELETE" />
2ab211e0aecd changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
153 # Or using helpers:
2ab211e0aecd changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
154 # h.form(url('repos_group', id=ID),
2ab211e0aecd changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
155 # method='delete')
2ab211e0aecd changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
156 # url('repos_group', id=ID)
2ab211e0aecd changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
157
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
158 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
159 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
160 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
161 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
162 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
163 '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
164 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
165 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
166
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 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
168 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
169 h.flash(_('removed repos group %s' % gr.group_name), category='success')
1482
a39c0e5fca89 removed obsolete sort code
Marcin Kuzminski <marcin@python-works.com>
parents: 1394
diff changeset
170 #TODO: in future action_logger(, '', '', '', self.sa)
1543
ada6926c374f Added friendly message about removing a group that still contains subgroups.
Marcin Kuzminski <marcin@python-works.com>
parents: 1538
diff changeset
171 except IntegrityError, e:
ada6926c374f Added friendly message about removing a group that still contains subgroups.
Marcin Kuzminski <marcin@python-works.com>
parents: 1538
diff changeset
172 if e.message.find('groups_group_parent_id_fkey'):
ada6926c374f Added friendly message about removing a group that still contains subgroups.
Marcin Kuzminski <marcin@python-works.com>
parents: 1538
diff changeset
173 log.error(traceback.format_exc())
ada6926c374f Added friendly message about removing a group that still contains subgroups.
Marcin Kuzminski <marcin@python-works.com>
parents: 1538
diff changeset
174 h.flash(_('Cannot delete this group it still contains '
ada6926c374f Added friendly message about removing a group that still contains subgroups.
Marcin Kuzminski <marcin@python-works.com>
parents: 1538
diff changeset
175 'subgroups'),
ada6926c374f Added friendly message about removing a group that still contains subgroups.
Marcin Kuzminski <marcin@python-works.com>
parents: 1538
diff changeset
176 category='warning')
ada6926c374f Added friendly message about removing a group that still contains subgroups.
Marcin Kuzminski <marcin@python-works.com>
parents: 1538
diff changeset
177 else:
ada6926c374f Added friendly message about removing a group that still contains subgroups.
Marcin Kuzminski <marcin@python-works.com>
parents: 1538
diff changeset
178 log.error(traceback.format_exc())
ada6926c374f Added friendly message about removing a group that still contains subgroups.
Marcin Kuzminski <marcin@python-works.com>
parents: 1538
diff changeset
179 h.flash(_('error occurred during deletion of repos '
ada6926c374f Added friendly message about removing a group that still contains subgroups.
Marcin Kuzminski <marcin@python-works.com>
parents: 1538
diff changeset
180 'group %s' % gr.group_name), category='error')
ada6926c374f Added friendly message about removing a group that still contains subgroups.
Marcin Kuzminski <marcin@python-works.com>
parents: 1538
diff changeset
181
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
182 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
183 log.error(traceback.format_exc())
1543
ada6926c374f Added friendly message about removing a group that still contains subgroups.
Marcin Kuzminski <marcin@python-works.com>
parents: 1538
diff changeset
184 h.flash(_('error occurred during deletion of repos '
ada6926c374f Added friendly message about removing a group that still contains subgroups.
Marcin Kuzminski <marcin@python-works.com>
parents: 1538
diff changeset
185 'group %s' % gr.group_name), category='error')
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
186
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
187 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
188
1538
27be8f94c207 implements #226 repo groups available by path
Marcin Kuzminski <marcin@python-works.com>
parents: 1482
diff changeset
189 def show_by_name(self, group_name):
27be8f94c207 implements #226 repo groups available by path
Marcin Kuzminski <marcin@python-works.com>
parents: 1482
diff changeset
190 id_ = Group.get_by_group_name(group_name).group_id
27be8f94c207 implements #226 repo groups available by path
Marcin Kuzminski <marcin@python-works.com>
parents: 1482
diff changeset
191 return self.show(id_)
27be8f94c207 implements #226 repo groups available by path
Marcin Kuzminski <marcin@python-works.com>
parents: 1482
diff changeset
192
1171
2ab211e0aecd changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
193 def show(self, id, format='html'):
2ab211e0aecd changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
194 """GET /repos_groups/id: Show a specific item"""
2ab211e0aecd changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
195 # url('repos_group', id=ID)
2ab211e0aecd changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
196
1482
a39c0e5fca89 removed obsolete sort code
Marcin Kuzminski <marcin@python-works.com>
parents: 1394
diff changeset
197 c.group = Group.get(id)
1366
9c0f5d558789 fixes #200, rewrote the whole caching mechanism to get rid of such problems. Now cached instances are attached
Marcin Kuzminski <marcin@python-works.com>
parents: 1349
diff changeset
198
1193
523382549c45 Added repo group page showing what reposiories are inside a group
Marcin Kuzminski <marcin@python-works.com>
parents: 1171
diff changeset
199 if c.group:
1343
a04fe5986109 #47 implemented basic gui for browsing repo groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1245
diff changeset
200 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
201 else:
1394
416dacac46bf fixed improper redirect for repos groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1366
diff changeset
202 return redirect(url('home'))
1193
523382549c45 Added repo group page showing what reposiories are inside a group
Marcin Kuzminski <marcin@python-works.com>
parents: 1171
diff changeset
203
523382549c45 Added repo group page showing what reposiories are inside a group
Marcin Kuzminski <marcin@python-works.com>
parents: 1171
diff changeset
204 #overwrite our cached list with current filter
1366
9c0f5d558789 fixes #200, rewrote the whole caching mechanism to get rid of such problems. Now cached instances are attached
Marcin Kuzminski <marcin@python-works.com>
parents: 1349
diff changeset
205 gr_filter = c.group_repos
1193
523382549c45 Added repo group page showing what reposiories are inside a group
Marcin Kuzminski <marcin@python-works.com>
parents: 1171
diff changeset
206 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
207
1366
9c0f5d558789 fixes #200, rewrote the whole caching mechanism to get rid of such problems. Now cached instances are attached
Marcin Kuzminski <marcin@python-works.com>
parents: 1349
diff changeset
208 c.repos_list = c.cached_repo_list
1193
523382549c45 Added repo group page showing what reposiories are inside a group
Marcin Kuzminski <marcin@python-works.com>
parents: 1171
diff changeset
209
1366
9c0f5d558789 fixes #200, rewrote the whole caching mechanism to get rid of such problems. Now cached instances are attached
Marcin Kuzminski <marcin@python-works.com>
parents: 1349
diff changeset
210 c.repo_cnt = 0
1343
a04fe5986109 #47 implemented basic gui for browsing repo groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1245
diff changeset
211
a04fe5986109 #47 implemented basic gui for browsing repo groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1245
diff changeset
212 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
213 .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
214
1193
523382549c45 Added repo group page showing what reposiories are inside a group
Marcin Kuzminski <marcin@python-works.com>
parents: 1171
diff changeset
215 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
216
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
217 @HasPermissionAnyDecorator('hg.admin')
1171
2ab211e0aecd changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
218 def edit(self, id, format='html'):
2ab211e0aecd changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
219 """GET /repos_groups/id/edit: Form to edit an existing item"""
2ab211e0aecd changes for #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
220 # 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
221
1482
a39c0e5fca89 removed obsolete sort code
Marcin Kuzminski <marcin@python-works.com>
parents: 1394
diff changeset
222 id_ = int(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
223
1482
a39c0e5fca89 removed obsolete sort code
Marcin Kuzminski <marcin@python-works.com>
parents: 1394
diff changeset
224 c.repos_group = Group.get(id_)
a39c0e5fca89 removed obsolete sort code
Marcin Kuzminski <marcin@python-works.com>
parents: 1394
diff changeset
225 defaults = self.__load_data(id_)
1347
43b8e161be3f #47 implemented basic edition of groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1346
diff changeset
226
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
227 # we need to exclude this group from the group list for editing
1482
a39c0e5fca89 removed obsolete sort code
Marcin Kuzminski <marcin@python-works.com>
parents: 1394
diff changeset
228 c.repo_groups = filter(lambda x:x[0] != id_, c.repo_groups)
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
229
1347
43b8e161be3f #47 implemented basic edition of groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1346
diff changeset
230 return htmlfill.render(
43b8e161be3f #47 implemented basic edition of groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1346
diff changeset
231 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
232 defaults=defaults,
43b8e161be3f #47 implemented basic edition of groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1346
diff changeset
233 encoding="UTF-8",
43b8e161be3f #47 implemented basic edition of groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1346
diff changeset
234 force_defaults=False
43b8e161be3f #47 implemented basic edition of groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1346
diff changeset
235 )
43b8e161be3f #47 implemented basic edition of groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1346
diff changeset
236
43b8e161be3f #47 implemented basic edition of groups
Marcin Kuzminski <marcin@python-works.com>
parents: 1346
diff changeset
237