From 2aa26fff04a98f2435e8e3015e92ef6108d3b485 Mon Sep 17 00:00:00 2001 From: Kenneth Reitz Date: Fri, 21 Mar 2014 17:12:26 -0400 Subject: [PATCH] Revert "Merge pull request #859 from wvh/register_error_handler" This reverts commit 6347e75deea2eda444c60080fda3885c1fb7705d, reversing changes made to 3fd40e83e5df4dbde8531a76c42d26bf76674e95. --- flask/blueprints.py | 11 ----------- flask/testsuite/blueprints.py | 33 --------------------------------- 2 files changed, 44 deletions(-) diff --git a/flask/blueprints.py b/flask/blueprints.py index 4abc0ffa..45faf2c5 100644 --- a/flask/blueprints.py +++ b/flask/blueprints.py @@ -399,14 +399,3 @@ class Blueprint(_PackageBoundObject): self.name, code_or_exception, f)) return f return decorator - - def register_error_handler(self, code_or_exception, f): - """Non-decorator version of the :meth:`errorhandler` error attach - function, akin to the :meth:`~flask.Flask.register_error_handler` - application-wide function of the :class:`~flask.Flask` object but - for error handlers limited to this blueprint. - - .. versionadded:: 0.11 - """ - self.record_once(lambda s: s.app._register_error_handler( - self.name, code_or_exception, f)) diff --git a/flask/testsuite/blueprints.py b/flask/testsuite/blueprints.py index 8b3e530c..8a0e5a79 100644 --- a/flask/testsuite/blueprints.py +++ b/flask/testsuite/blueprints.py @@ -296,39 +296,6 @@ class BlueprintTestCase(FlaskTestCase): self.assert_equal(c.get('/backend-no').data, b'backend says no') self.assert_equal(c.get('/what-is-a-sideend').data, b'application itself says no') - def test_blueprint_specific_user_error_handling(self): - class MyDecoratorException(Exception): - pass - class MyFunctionException(Exception): - pass - - blue = flask.Blueprint('blue', __name__) - - @blue.errorhandler(MyDecoratorException) - def my_decorator_exception_handler(e): - self.assert_true(isinstance(e, MyDecoratorException)) - return 'boom' - - def my_function_exception_handler(e): - self.assert_true(isinstance(e, MyFunctionException)) - return 'bam' - blue.register_error_handler(MyFunctionException, my_function_exception_handler) - - @blue.route('/decorator') - def blue_deco_test(): - raise MyDecoratorException() - @blue.route('/function') - def blue_func_test(): - raise MyFunctionException() - - app = flask.Flask(__name__) - app.register_blueprint(blue) - - c = app.test_client() - - self.assert_equal(c.get('/decorator').data, b'boom') - self.assert_equal(c.get('/function').data, b'bam') - def test_blueprint_url_definitions(self): bp = flask.Blueprint('test', __name__)