# HG changeset patch # User domruf # Date 1494358680 -7200 # Node ID 169dc4bd9d5b9c432d41de92750bafcb8c7f3f51 # Parent 46e31d17109692401a511d64fe7c669c2aefe56d 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. diff -r 46e31d171096 -r 169dc4bd9d5b kallithea/controllers/admin/repos.py --- 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')