Changeset - c35429c32d7f
[Not reviewed]
default
0 1 0
Mads Kiilerich - 11 years ago 2014-08-12 13:08:23
madski@unity3d.com
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.
1 file changed with 3 insertions and 2 deletions:
0 comments (0 inline, 0 general)
kallithea/controllers/pullrequests.py
Show inline comments
 
@@ -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']
0 comments (0 inline, 0 general)