Show More
@@ -9,9 +9,10 b' from pylons import request, response, se' | |||||
9 | from pylons.controllers.util import abort, redirect |
|
9 | from pylons.controllers.util import abort, redirect | |
10 | from pylons.i18n.translation import _ |
|
10 | from pylons.i18n.translation import _ | |
11 |
|
11 | |||
|
12 | from sqlalchemy.exc import IntegrityError | |||
|
13 | ||||
12 | from rhodecode.lib import helpers as h |
|
14 | from rhodecode.lib import helpers as h | |
13 |
from rhodecode.lib.auth import LoginRequired, HasPermissionA |
|
15 | from rhodecode.lib.auth import LoginRequired, HasPermissionAnyDecorator | |
14 | HasPermissionAnyDecorator |
|
|||
15 | from rhodecode.lib.base import BaseController, render |
|
16 | from rhodecode.lib.base import BaseController, render | |
16 | from rhodecode.model.db import Group |
|
17 | from rhodecode.model.db import Group | |
17 | from rhodecode.model.repos_group import ReposGroupModel |
|
18 | from rhodecode.model.repos_group import ReposGroupModel | |
@@ -167,10 +168,21 b' class ReposGroupsController(BaseControll' | |||||
167 | repos_group_model.delete(id) |
|
168 | repos_group_model.delete(id) | |
168 | h.flash(_('removed repos group %s' % gr.group_name), category='success') |
|
169 | h.flash(_('removed repos group %s' % gr.group_name), category='success') | |
169 | #TODO: in future action_logger(, '', '', '', self.sa) |
|
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 | except Exception: |
|
182 | except Exception: | |
171 | log.error(traceback.format_exc()) |
|
183 | log.error(traceback.format_exc()) | |
172 |
h.flash(_('error occurred during deletion of repos |
|
184 | h.flash(_('error occurred during deletion of repos ' | |
173 | category='error') |
|
185 | 'group %s' % gr.group_name), category='error') | |
174 |
|
186 | |||
175 | return redirect(url('repos_groups')) |
|
187 | return redirect(url('repos_groups')) | |
176 |
|
188 |
@@ -100,7 +100,9 b' class ReposGroupModel(BaseModel):' | |||||
100 | paths = os.sep.join(paths) |
|
100 | paths = os.sep.join(paths) | |
101 |
|
101 | |||
102 | rm_path = os.path.join(self.repos_path, paths) |
|
102 | rm_path = os.path.join(self.repos_path, paths) | |
103 |
os. |
|
103 | if os.path.isdir(rm_path): | |
|
104 | # delete only if that path really exists | |||
|
105 | os.rmdir(rm_path) | |||
104 |
|
106 | |||
105 | def create(self, form_data): |
|
107 | def create(self, form_data): | |
106 | try: |
|
108 | try: |
General Comments 0
You need to be logged in to leave comments.
Login now