Skip to content
Myr

Merge pull request #4596 from pallets/url_for-template

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

use app.url_for as template global

authored by David Lord · committed by GitHub · parents 00e2aac, 69e2300 · Browse files · 2 files+4 added−2 removed
This commit

State

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

Diff stats

2 files+4 added−2 removed

  • other:+4 added−2 removed

2 files+4 added−2 removed

modified:src/flask/app.py+3 added-2 removed
43 unmodified lines
44from .helpers import get_env45from .helpers import get_flashed_messages46from .helpers import get_load_dotenv47from .helpers import locked_cached_property48from .helpers import url_for48from .json import jsonify49from .logging import create_logger50from .scaffold import _endpoint_from_view_func51from .scaffold import _sentinel
385 unmodified lines
437 #: :meth:`make_aborter`. This is called by :func:`flask.abort`438 #: to raise HTTP errors, and can be called directly as well.439 #:440 #: .. versionadded:: 2.2441 #: Moved from ``flask.abort``, which calls this object.442 self.aborter = self.make_aborter()443444 #: A list of functions that are called by445 #: :meth:`handle_url_build_error` when :meth:`.url_for` raises a
280 unmodified lines
726 options["auto_reload"] = self.templates_auto_reload727728 rv = self.jinja_environment(self, **options)729 rv.globals.update(730 url_for=url_for,730 url_for=self.url_for,731 get_flashed_messages=get_flashed_messages,732 config=self.config,733 # request, session and g are normally added with the734 # context processor for efficiency reasons but for imported
1062 unmodified lines
1797 :param location: The URL to redirect to.1798 :param code: The status code for the redirect.17991800 .. versionadded:: 2.21801 Moved from ``flask.redirect``, which calls this method.1802 """1803 return _wz_redirect(location, code=code, Response=self.response_class)18041805 def make_response(self, rv: ResponseReturnValue) -> Response:
473 unmodified lines
modified:CHANGES.rst+1 added
6 unmodified lines
78- Add new customization points to the ``Flask`` app object for many9 previously global behaviors.1011 - ``flask.url_for`` will call ``app.url_for``. :issue:`4568`12 - ``flask.abort`` will call ``app.aborter``.13 ``Flask.aborter_class`` and ``Flask.make_aborter`` can be used14 to customize this aborter. :issue:`4567`15 - ``flask.redirect`` will call ``app.redirect``. :issue:`4569`
1287 unmodified lines