From a15c6c569ab40f0da2d18b1bd338bd03ddb024eb Mon Sep 17 00:00:00 2001 From: Mitchell Peabody Date: Tue, 16 Oct 2012 16:57:57 -0400 Subject: [PATCH 1/2] The builder on github is using python 2.5, the views.py testsuite uses the with statement, and thus flask/testsuite/views.py requires from __future__ import with_statement at the beginning. --- flask/testsuite/views.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flask/testsuite/views.py b/flask/testsuite/views.py index 350eb7f2..f09c1266 100644 --- a/flask/testsuite/views.py +++ b/flask/testsuite/views.py @@ -8,13 +8,13 @@ :copyright: (c) 2011 by Armin Ronacher. :license: BSD, see LICENSE for more details. """ +from __future__ import with_statement import flask import flask.views import unittest from flask.testsuite import FlaskTestCase from werkzeug.http import parse_set_header - class ViewTestCase(FlaskTestCase): def common_test(self, app): From 275f830c8346c29af424b1ed2f2ffabee2408ec8 Mon Sep 17 00:00:00 2001 From: Mitchell Peabody Date: Wed, 17 Oct 2012 11:56:39 -0400 Subject: [PATCH 2/2] 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