Changeset - 169dc4bd9d5b
[Not reviewed]
default
0 1 0
domruf - 9 years ago 2017-05-09 21:38:00
dominikruf@gmail.com
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.
1 file changed with 3 insertions and 4 deletions:
0 comments (0 inline, 0 general)
kallithea/controllers/admin/repos.py
Show inline comments
 
@@ -387,12 +387,11 @@ class ReposController(BaseRepoController
 
            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')
0 comments (0 inline, 0 general)