# HG changeset patch # User Mads Kiilerich # Date 2014-08-12 13:08:23 # Node ID c35429c32d7febc3242e631a0924681b0c4138ba # Parent 00c76c4e019c727365433b5a6234bac2af0c06d5 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. diff --git a/kallithea/controllers/pullrequests.py b/kallithea/controllers/pullrequests.py --- a/kallithea/controllers/pullrequests.py +++ b/kallithea/controllers/pullrequests.py @@ -30,7 +30,7 @@ import traceback 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 @@ class PullrequestsController(BaseRepoCon _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']