Mercurial > kallithea
changeset 4435:c35429c32d7f
pull request: fail on form errors - don't redirect
The error page might not be pretty but it is very usable - the user can go back and fix the problem.
author | Mads Kiilerich <madski@unity3d.com> |
---|---|
date | Tue, 12 Aug 2014 13:08:23 +0200 |
parents | 00c76c4e019c |
children | 63c005d9b858 |
files | kallithea/controllers/pullrequests.py |
diffstat | 1 files changed, 3 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/kallithea/controllers/pullrequests.py Tue Aug 12 13:08:23 2014 +0200 +++ b/kallithea/controllers/pullrequests.py Tue Aug 12 13:08:23 2014 +0200 @@ -30,7 +30,7 @@ import formencode import re -from webob.exc import HTTPNotFound, HTTPForbidden +from webob.exc import HTTPNotFound, HTTPForbidden, HTTPBadRequest from pylons import request, tmpl_context as c, url from pylons.controllers.util import redirect @@ -408,9 +408,10 @@ _form = PullRequestForm(repo.repo_id)().to_python(request.POST) except formencode.Invalid, errors: log.error(traceback.format_exc()) + log.error(str(errors)) msg = _('Error creating pull request: %s') % errors.msg h.flash(msg, 'error') - return redirect(url('pullrequest_home', repo_name=repo_name)) ## would rather just go back to form ... + raise HTTPBadRequest # heads up: org and other might seem backward here ... org_repo_name = _form['org_repo']