comparison rhodecode/controllers/admin/users.py @ 2496:fddd8e3fc157 beta

use get_or_404 where possible
author Marcin Kuzminski <marcin@python-works.com>
date Wed, 20 Jun 2012 21:42:05 +0200
parents 9225597688f4
children 385b768b75ea
comparison
equal deleted inserted replaced
2495:9766f0baf5c5 2496:fddd8e3fc157
170 # url('user', id=ID) 170 # url('user', id=ID)
171 171
172 def edit(self, id, format='html'): 172 def edit(self, id, format='html'):
173 """GET /users/id/edit: Form to edit an existing item""" 173 """GET /users/id/edit: Form to edit an existing item"""
174 # url('edit_user', id=ID) 174 # url('edit_user', id=ID)
175 c.user = User.get(id) 175 c.user = User.get_or_404(id)
176 if not c.user: 176
177 return redirect(url('users'))
178 if c.user.username == 'default': 177 if c.user.username == 'default':
179 h.flash(_("You can't edit this user"), category='warning') 178 h.flash(_("You can't edit this user"), category='warning')
180 return redirect(url('users')) 179 return redirect(url('users'))
181 c.perm_user = AuthUser(user_id=id) 180 c.perm_user = AuthUser(user_id=id)
182 c.user.permissions = {} 181 c.user.permissions = {}