Mercurial > kallithea
diff rhodecode/model/user.py @ 713:1bb0fcdec895 beta
fixed #72 show warning on removal when user still is owner of existing repositories
cleaned up exceptions
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Thu, 18 Nov 2010 03:29:23 +0100 |
parents | 9e9f1b919c0c |
children | 1377a9d4bdb9 |
line wrap: on
line diff
--- a/rhodecode/model/user.py Thu Nov 18 03:05:29 2010 +0100 +++ b/rhodecode/model/user.py Thu Nov 18 03:29:23 2010 +0100 @@ -27,12 +27,13 @@ from rhodecode.model.caching_query import FromCache from rhodecode.model.db import User from rhodecode.model.meta import Session +from rhodecode.lib.exceptions import * import logging import traceback log = logging.getLogger(__name__) -class DefaultUserException(Exception):pass + class UserModel(object): @@ -128,6 +129,7 @@ raise DefaultUserException( _("You can't Edit this user since it's" " crucial for entire application")) + for k, v in form_data.items(): if k == 'new_password' and v != '': new_user.password = v @@ -169,6 +171,12 @@ raise DefaultUserException( _("You can't remove this user since it's" " crucial for entire application")) + if user.repositories: + raise UserOwnsReposException(_('This user still owns %s ' + 'repositories and cannot be ' + 'removed. Switch owners or ' + 'remove those repositories') \ + % user.repositories) self.sa.delete(user) self.sa.commit() except: