@@ -478,8 +478,11 @@ def add_url_rule(
478478 provide_automatic_options : t .Optional [bool ] = None ,
479479 ** options : t .Any ,
480480 ) -> None :
481- """Like :meth:`Flask.add_url_rule` but for a blueprint. The endpoint for
482- the :func:`url_for` function is prefixed with the name of the blueprint.
481+ """Register a URL rule with the blueprint. See :meth:`.Flask.add_url_rule` for
482+ full documentation.
483+
484+ The URL rule is prefixed with the blueprint's URL prefix. The endpoint name,
485+ used with :func:`url_for`, is prefixed with the blueprint's name.
483486 """
484487 if endpoint and "." in endpoint :
485488 raise ValueError ("'endpoint' may not contain a dot '.' character." )
@@ -501,8 +504,8 @@ def add_url_rule(
501504 def app_template_filter (
502505 self , name : t .Optional [str ] = None
503506 ) -> t .Callable [[T_template_filter ], T_template_filter ]:
504- """Register a custom template filter, available application wide. Like
505- :meth:`Flask.template_filter` but for a blueprint .
507+ """Register a template filter, available in any template rendered by the
508+ application. Equivalent to :meth:`. Flask.template_filter`.
506509
507510 :param name: the optional name of the filter, otherwise the
508511 function name will be used.
@@ -518,9 +521,9 @@ def decorator(f: T_template_filter) -> T_template_filter:
518521 def add_app_template_filter (
519522 self , f : ft .TemplateFilterCallable , name : t .Optional [str ] = None
520523 ) -> None :
521- """Register a custom template filter, available application wide. Like
522- :meth:`Flask.add_template_filter` but for a blueprint. Works exactly
523- like the :meth:`app_template_filter` decorator .
524+ """Register a template filter, available in any template rendered by the
525+ application. Works like the :meth:`app_template_filter` decorator. Equivalent to
526+ :meth:`.Flask.add_template_filter` .
524527
525528 :param name: the optional name of the filter, otherwise the
526529 function name will be used.
@@ -535,8 +538,8 @@ def register_template(state: BlueprintSetupState) -> None:
535538 def app_template_test (
536539 self , name : t .Optional [str ] = None
537540 ) -> t .Callable [[T_template_test ], T_template_test ]:
538- """Register a custom template test, available application wide. Like
539- :meth:`Flask.template_test` but for a blueprint .
541+ """Register a template test, available in any template rendered by the
542+ application. Equivalent to :meth:`. Flask.template_test`.
540543
541544 .. versionadded:: 0.10
542545
@@ -554,9 +557,9 @@ def decorator(f: T_template_test) -> T_template_test:
554557 def add_app_template_test (
555558 self , f : ft .TemplateTestCallable , name : t .Optional [str ] = None
556559 ) -> None :
557- """Register a custom template test, available application wide. Like
558- :meth:`Flask.add_template_test` but for a blueprint. Works exactly
559- like the :meth:`app_template_test` decorator .
560+ """Register a template test, available in any template rendered by the
561+ application. Works like the :meth:`app_template_test` decorator. Equivalent to
562+ :meth:`.Flask.add_template_test` .
560563
561564 .. versionadded:: 0.10
562565
@@ -573,8 +576,8 @@ def register_template(state: BlueprintSetupState) -> None:
573576 def app_template_global (
574577 self , name : t .Optional [str ] = None
575578 ) -> t .Callable [[T_template_global ], T_template_global ]:
576- """Register a custom template global, available application wide. Like
577- :meth:`Flask.template_global` but for a blueprint .
579+ """Register a template global, available in any template rendered by the
580+ application. Equivalent to :meth:`. Flask.template_global`.
578581
579582 .. versionadded:: 0.10
580583
@@ -592,9 +595,9 @@ def decorator(f: T_template_global) -> T_template_global:
592595 def add_app_template_global (
593596 self , f : ft .TemplateGlobalCallable , name : t .Optional [str ] = None
594597 ) -> None :
595- """Register a custom template global, available application wide. Like
596- :meth:`Flask.add_template_global` but for a blueprint. Works exactly
597- like the :meth:`app_template_global` decorator .
598+ """Register a template global, available in any template rendered by the
599+ application. Works like the :meth:`app_template_global` decorator. Equivalent to
600+ :meth:`.Flask.add_template_global` .
598601
599602 .. versionadded:: 0.10
600603
@@ -609,8 +612,8 @@ def register_template(state: BlueprintSetupState) -> None:
609612
610613 @setupmethod
611614 def before_app_request (self , f : T_before_request ) -> T_before_request :
612- """Like :meth:`Flask. before_request`. Such a function is executed
613- before each request, even if outside of a blueprint .
615+ """Like :meth:`before_request`, but before every request, not only those handled
616+ by the blueprint. Equivalent to :meth:`.Flask.before_request` .
614617 """
615618 self .record_once (
616619 lambda s : s .app .before_request_funcs .setdefault (None , []).append (f )
@@ -621,8 +624,8 @@ def before_app_request(self, f: T_before_request) -> T_before_request:
621624 def before_app_first_request (
622625 self , f : T_before_first_request
623626 ) -> T_before_first_request :
624- """Like :meth:`Flask.before_first_request`. Such a function is
625- executed before the first request to the application .
627+ """Register a function to run before the first request to the application is
628+ handled by the worker. Equivalent to :meth:`.Flask.before_first_request` .
626629
627630 .. deprecated:: 2.2
628631 Will be removed in Flask 2.3. Run setup code when creating
@@ -642,8 +645,8 @@ def before_app_first_request(
642645
643646 @setupmethod
644647 def after_app_request (self , f : T_after_request ) -> T_after_request :
645- """Like :meth:`Flask. after_request` but for a blueprint. Such a function
646- is executed after each request, even if outside of the blueprint .
648+ """Like :meth:`after_request`, but after every request, not only those handled
649+ by the blueprint. Equivalent to :meth:`.Flask.after_request` .
647650 """
648651 self .record_once (
649652 lambda s : s .app .after_request_funcs .setdefault (None , []).append (f )
@@ -652,9 +655,8 @@ def after_app_request(self, f: T_after_request) -> T_after_request:
652655
653656 @setupmethod
654657 def teardown_app_request (self , f : T_teardown ) -> T_teardown :
655- """Like :meth:`Flask.teardown_request` but for a blueprint. Such a
656- function is executed when tearing down each request, even if outside of
657- the blueprint.
658+ """Like :meth:`teardown_request`, but after every request, not only those
659+ handled by the blueprint. Equivalent to :meth:`.Flask.teardown_request`.
658660 """
659661 self .record_once (
660662 lambda s : s .app .teardown_request_funcs .setdefault (None , []).append (f )
@@ -665,8 +667,8 @@ def teardown_app_request(self, f: T_teardown) -> T_teardown:
665667 def app_context_processor (
666668 self , f : T_template_context_processor
667669 ) -> T_template_context_processor :
668- """Like :meth:`Flask. context_processor` but for a blueprint. Such a
669- function is executed each request, even if outside of the blueprint .
670+ """Like :meth:`context_processor`, but for templates rendered by every view, not
671+ only by the blueprint. Equivalent to :meth:`.Flask.context_processor` .
670672 """
671673 self .record_once (
672674 lambda s : s .app .template_context_processors .setdefault (None , []).append (f )
@@ -677,8 +679,8 @@ def app_context_processor(
677679 def app_errorhandler (
678680 self , code : t .Union [t .Type [Exception ], int ]
679681 ) -> t .Callable [[T_error_handler ], T_error_handler ]:
680- """Like :meth:`Flask. errorhandler` but for a blueprint. This
681- handler is used for all requests, even if outside of the blueprint .
682+ """Like :meth:`errorhandler`, but for every request, not only those handled by
683+ the blueprint. Equivalent to :meth:`.Flask.errorhandler` .
682684 """
683685
684686 def decorator (f : T_error_handler ) -> T_error_handler :
@@ -691,15 +693,19 @@ def decorator(f: T_error_handler) -> T_error_handler:
691693 def app_url_value_preprocessor (
692694 self , f : T_url_value_preprocessor
693695 ) -> T_url_value_preprocessor :
694- """Same as :meth:`url_value_preprocessor` but application wide."""
696+ """Like :meth:`url_value_preprocessor`, but for every request, not only those
697+ handled by the blueprint. Equivalent to :meth:`.Flask.url_value_preprocessor`.
698+ """
695699 self .record_once (
696700 lambda s : s .app .url_value_preprocessors .setdefault (None , []).append (f )
697701 )
698702 return f
699703
700704 @setupmethod
701705 def app_url_defaults (self , f : T_url_defaults ) -> T_url_defaults :
702- """Same as :meth:`url_defaults` but application wide."""
706+ """Like :meth:`url_defaults`, but for every request, not only those handled by
707+ the blueprint. Equivalent to :meth:`.Flask.url_defaults`.
708+ """
703709 self .record_once (
704710 lambda s : s .app .url_default_functions .setdefault (None , []).append (f )
705711 )
0 commit comments