Exemplo n.º 1
0
 def before_init_app(self, app: FlaskUnchained):
     """
     Configure the Jinja environment and template loader.
     """
     from .templates import (UnchainedJinjaEnvironment,
                             UnchainedJinjaLoader)
     app.jinja_environment = UnchainedJinjaEnvironment
     app.jinja_options = {
         **app.jinja_options, 'loader': UnchainedJinjaLoader(app)
     }
     app.jinja_env.globals['url_for'] = url_for
Exemplo n.º 2
0
    def before_init_app(self, app: FlaskUnchained):
        """
        Configure the Jinja environment and template loader.
        """
        from .templates import (UnchainedJinjaEnvironment,
                                UnchainedJinjaLoader)
        app.jinja_environment = UnchainedJinjaEnvironment
        app.jinja_options = {
            **app.jinja_options, 'loader': UnchainedJinjaLoader(app)
        }
        app.jinja_env.globals['url_for'] = url_for

        for name in ['string', 'str']:
            app.url_map.converters[name] = StringConverter