Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Minor fix to views.py testsuite. #614

Merged
merged 2 commits into from

2 participants

@mizhi

The builder/ci server for 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.

Mitchell Pea... added some commits
Mitchell Peabody The builder on github is using python 2.5, the views.py testsuite use…
…s the with

statement, and thus flask/testsuite/views.py requires

from __future__ import with_statement

at the beginning.
a15c6c5
Mitchell Peabody 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.
275f830
@mizhi

Added a commit to remove a duplicated method call.

@mitsuhiko
Owner

Looks good.

@mitsuhiko mitsuhiko merged commit f06c80a into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Oct 16, 2012
  1. The builder on github is using python 2.5, the views.py testsuite use…

    Mitchell Peabody authored
    …s the with
    
    statement, and thus flask/testsuite/views.py requires
    
    from __future__ import with_statement
    
    at the beginning.
Commits on Oct 17, 2012
  1. There was a duplicated call to url_adapter.build(...)

    Mitchell Peabody authored
        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.
This page is out of date. Refresh to see the latest.
Showing with 1 addition and 3 deletions.
  1. +0 −2  flask/helpers.py
  2. +1 −1  flask/testsuite/views.py
View
2  flask/helpers.py
@@ -295,8 +295,6 @@ def external_url_handler(error, 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
View
2  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):
Something went wrong with that request. Please try again.