Skip to content
Myr

Add a non-decorator version of the error handler register function

Before adoption: this commit came in with the history the project adopted, so no landing records it.

The main application object has a register_error_handler function which mirrors the decorator's functionality. According to the principle of least surprise, make sure blueprints also have this convenience function.

authored by Wouter Van Hemel · committed by Wouter Van Hemel · parent 36d70d8 · Browse files · 1 file+11 added−0 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+11 added−0 removed

  • other:+11 added−0 removed

1 file+11 added−0 removed

modified:flask/blueprints.py+11 added
397 unmodified lines
398 self.record_once(lambda s: s.app._register_error_handler(399 self.name, code_or_exception, f))400 return f401 return decorator402403 def register_error_handler(self, code_or_exception, f):404 """Non-decorator version of the :meth:`errorhandler` error attach405 function, akin to the :meth:`~flask.Flask.register_error_handler`406 application-wide function of the :class:`~flask.Flask` object but407 for error handlers limited to this blueprint.408409 .. versionadded:: 0.11410 """411 self.record_once(lambda s: s.app._register_error_handler(412 self.name, code_or_exception, f))