##// END OF EJS Templates
Added friendly message about removing a group that still contains subgroups....
marcink -
r1543:ada6926c beta
parent child Browse files
Show More
@@ -9,9 +9,10 b' from pylons import request, response, se'
9 9 from pylons.controllers.util import abort, redirect
10 10 from pylons.i18n.translation import _
11 11
12 from sqlalchemy.exc import IntegrityError
13
12 14 from rhodecode.lib import helpers as h
13 from rhodecode.lib.auth import LoginRequired, HasPermissionAllDecorator, \
14 HasPermissionAnyDecorator
15 from rhodecode.lib.auth import LoginRequired, HasPermissionAnyDecorator
15 16 from rhodecode.lib.base import BaseController, render
16 17 from rhodecode.model.db import Group
17 18 from rhodecode.model.repos_group import ReposGroupModel
@@ -167,10 +168,21 b' class ReposGroupsController(BaseControll'
167 168 repos_group_model.delete(id)
168 169 h.flash(_('removed repos group %s' % gr.group_name), category='success')
169 170 #TODO: in future action_logger(, '', '', '', self.sa)
171 except IntegrityError, e:
172 if e.message.find('groups_group_parent_id_fkey'):
173 log.error(traceback.format_exc())
174 h.flash(_('Cannot delete this group it still contains '
175 'subgroups'),
176 category='warning')
177 else:
178 log.error(traceback.format_exc())
179 h.flash(_('error occurred during deletion of repos '
180 'group %s' % gr.group_name), category='error')
181
170 182 except Exception:
171 183 log.error(traceback.format_exc())
172 h.flash(_('error occurred during deletion of repos group %s' % gr.group_name),
173 category='error')
184 h.flash(_('error occurred during deletion of repos '
185 'group %s' % gr.group_name), category='error')
174 186
175 187 return redirect(url('repos_groups'))
176 188
@@ -100,7 +100,9 b' class ReposGroupModel(BaseModel):'
100 100 paths = os.sep.join(paths)
101 101
102 102 rm_path = os.path.join(self.repos_path, paths)
103 os.rmdir(rm_path)
103 if os.path.isdir(rm_path):
104 # delete only if that path really exists
105 os.rmdir(rm_path)
104 106
105 107 def create(self, form_data):
106 108 try:
General Comments 0
You need to be logged in to leave comments. Login now