Mercurial > public > src > rhodecode
comparison pylons_app/controllers/admin/repos.py @ 391:ec7b76d4bda4
Added initial query skipp when seting up the app.
Added internal server error when deleting user using ajax permission form
removed graph unneded code
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Tue, 27 Jul 2010 14:41:43 +0200 |
parents | ebdd1a89cdd9 |
children | 78ad5c98e476 5cd6616b8673 |
comparison
equal
deleted
inserted
replaced
390:37235cd09703 | 391:ec7b76d4bda4 |
---|---|
14 # | 14 # |
15 # You should have received a copy of the GNU General Public License | 15 # You should have received a copy of the GNU General Public License |
16 # along with this program; if not, write to the Free Software | 16 # along with this program; if not, write to the Free Software |
17 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, | 17 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
18 # MA 02110-1301, USA. | 18 # MA 02110-1301, USA. |
19 """ | |
20 Created on April 7, 2010 | |
21 admin controller for pylons | |
22 @author: marcink | |
23 """ | |
19 from formencode import htmlfill | 24 from formencode import htmlfill |
20 from operator import itemgetter | 25 from operator import itemgetter |
21 from pylons import request, response, session, tmpl_context as c, url | 26 from pylons import request, response, session, tmpl_context as c, url |
22 from pylons.controllers.util import abort, redirect | 27 from pylons.controllers.util import abort, redirect |
23 from pylons.i18n.translation import _ | 28 from pylons.i18n.translation import _ |
29 from pylons_app.model.hg_model import HgModel | 34 from pylons_app.model.hg_model import HgModel |
30 from pylons_app.model.repo_model import RepoModel | 35 from pylons_app.model.repo_model import RepoModel |
31 import formencode | 36 import formencode |
32 import logging | 37 import logging |
33 import traceback | 38 import traceback |
34 """ | 39 from paste.httpexceptions import HTTPInternalServerError |
35 Created on April 7, 2010 | 40 |
36 admin controller for pylons | |
37 @author: marcink | |
38 """ | |
39 log = logging.getLogger(__name__) | 41 log = logging.getLogger(__name__) |
40 | 42 |
41 class ReposController(BaseController): | 43 class ReposController(BaseController): |
42 """REST Controller styled on the Atom Publishing Protocol""" | 44 """REST Controller styled on the Atom Publishing Protocol""" |
43 # To properly map this controller, ensure your config/routing.py | 45 # To properly map this controller, ensure your config/routing.py |
128 except Exception: | 130 except Exception: |
129 log.error(traceback.format_exc()) | 131 log.error(traceback.format_exc()) |
130 h.flash(_('error occured during update of repository %s') \ | 132 h.flash(_('error occured during update of repository %s') \ |
131 % repo_name, category='error') | 133 % repo_name, category='error') |
132 | 134 |
133 | |
134 return redirect(url('edit_repo', repo_name=changed_name)) | 135 return redirect(url('edit_repo', repo_name=changed_name)) |
135 | 136 |
136 def delete(self, repo_name): | 137 def delete(self, repo_name): |
137 """DELETE /repos/repo_name: Delete an existing item""" | 138 """DELETE /repos/repo_name: Delete an existing item""" |
138 # Forms posted to this method should contain a hidden field: | 139 # Forms posted to this method should contain a hidden field: |
172 repo_model = RepoModel() | 173 repo_model = RepoModel() |
173 repo_model.delete_perm_user(request.POST, repo_name) | 174 repo_model.delete_perm_user(request.POST, repo_name) |
174 except Exception as e: | 175 except Exception as e: |
175 h.flash(_('An error occured during deletion of repository user'), | 176 h.flash(_('An error occured during deletion of repository user'), |
176 category='error') | 177 category='error') |
177 | 178 raise HTTPInternalServerError() |
178 | 179 |
179 def show(self, repo_name, format='html'): | 180 def show(self, repo_name, format='html'): |
180 """GET /repos/repo_name: Show a specific item""" | 181 """GET /repos/repo_name: Show a specific item""" |
181 # url('repo', repo_name=ID) | 182 # url('repo', repo_name=ID) |
182 | 183 |