From 275f830c8346c29af424b1ed2f2ffabee2408ec8 Mon Sep 17 00:00:00 2001 From: Mitchell Peabody Date: Wed, 17 Oct 2012 11:56:39 -0400 Subject: [PATCH] There was a duplicated call to url_adapter.build(...) try: rv = url_adapter.build(endpoint, values, method=method, force_external=external) except BuildError, error: # We need to inject the values again so that the app callback can # deal with that sort of stuff. values['_external'] = external values['_anchor'] = anchor values['_method'] = method return appctx.app.handle_url_build_error(error, endpoint, values) rv = url_adapter.build(endpoint, values, method=method, force_external=external) If no exception was raised for url_adapter.build(...) then the same method call would be made after the try...except block. This is unnecessary. --- flask/helpers.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/flask/helpers.py b/flask/helpers.py index 3f06c116..6aea45c6 100644 --- a/flask/helpers.py +++ b/flask/helpers.py @@ -295,8 +295,6 @@ def url_for(endpoint, **values): values['_method'] = method return appctx.app.handle_url_build_error(error, endpoint, values) - rv = url_adapter.build(endpoint, values, method=method, - force_external=external) if anchor is not None: rv += '#' + url_quote(anchor) return rv