Mercurial > kallithea
changeset 6641:169dc4bd9d5b
repos: fix field form validation exception checking - it seems wrong to checking the exception type
Found by pylint. Will probably give better error messages in some cases.
author | domruf <dominikruf@gmail.com> |
---|---|
date | Tue, 09 May 2017 21:38:00 +0200 |
parents | 46e31d171096 |
children | 13879d044762 |
files | kallithea/controllers/admin/repos.py |
diffstat | 1 files changed, 3 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/kallithea/controllers/admin/repos.py Tue May 09 19:04:32 2017 +0200 +++ b/kallithea/controllers/admin/repos.py Tue May 09 21:38:00 2017 +0200 @@ -387,12 +387,11 @@ new_field.field_label = form_result['new_field_label'] Session().add(new_field) Session().commit() + except formencode.Invalid as e: + h.flash(_('Field validation error: %s') % e.msg, category='error') except Exception as e: log.error(traceback.format_exc()) - msg = _('An error occurred during creation of field') - if isinstance(e, formencode.Invalid): - msg += ". " + e.msg - h.flash(msg, category='error') + h.flash(_('An error occurred during creation of field: %r') % e, category='error') raise HTTPFound(location=url('edit_repo_fields', repo_name=repo_name)) @HasRepoPermissionLevelDecorator('admin')