Merge branch 'ThiefMaster-override-jinja-env'
This commit is contained in:
commit
d00f5cc9fe
4 changed files with 18 additions and 3 deletions
|
|
@ -157,6 +157,11 @@ class Flask(_PackageBoundObject):
|
|||
#: :class:`~flask.Response` for more information.
|
||||
response_class = Response
|
||||
|
||||
#: The class that is used for the Jinja environment.
|
||||
#:
|
||||
#: .. versionadded:: 1.0
|
||||
jinja_env_class = Environment
|
||||
|
||||
#: The class that is used for the :data:`~flask.g` instance.
|
||||
#:
|
||||
#: Example use cases for a custom class:
|
||||
|
|
@ -680,7 +685,7 @@ class Flask(_PackageBoundObject):
|
|||
options['auto_reload'] = self.config['TEMPLATES_AUTO_RELOAD']
|
||||
else:
|
||||
options['auto_reload'] = self.debug
|
||||
rv = Environment(self, **options)
|
||||
rv = self.jinja_env_class(self, **options)
|
||||
rv.globals.update(
|
||||
url_for=url_for,
|
||||
get_flashed_messages=get_flashed_messages,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue