def __init__(self, application):
        self.xml_cache = file_cache.make_file_cache('XML',
                                                    'xml_root',
                                                    get_abs_path(
                                                        application.app_root,
                                                        options.xml_root),
                                                    xml_from_file,
                                                    options.xml_cache_limit,
                                                    options.xml_cache_step,
                                                    deepcopy=True)

        self.xsl_cache = file_cache.make_file_cache(
            'XSL', 'xsl_root',
            get_abs_path(application.app_root, options.xsl_root),
            xsl_from_file, options.xsl_cache_limit, options.xsl_cache_step)

        self.executor = ThreadPoolExecutor(options.xsl_executor_pool_size)
Exemple #2
0
    def get_jinja_environment(self):
        env = jinja2.Environment(
            loader=jinja2.FileSystemLoader(get_abs_path(self.app_root, options.jinja_template_root)),
        )

        env.globals['custom_env_function'] = lambda: 'custom_env_function_value'

        return env
Exemple #3
0
    def __init__(self, application):
        self.xml_cache = file_cache.make_file_cache(
            'XML', 'xml_root',
            get_abs_path(application.app_root, options.xml_root),
            xml_from_file,
            options.xml_cache_limit,
            options.xml_cache_step,
            deepcopy=True
        )

        self.xsl_cache = file_cache.make_file_cache(
            'XSL', 'xsl_root',
            get_abs_path(application.app_root, options.xsl_root),
            xsl_from_file,
            options.xsl_cache_limit,
            options.xsl_cache_step
        )

        self.executor = ThreadPoolExecutor(options.xsl_executor_pool_size)
Exemple #4
0
 def __init__(self, application):
     if hasattr(application, 'get_jinja_environment'):
         self.environment = application.get_jinja_environment()
     elif options.jinja_template_root is not None:
         self.environment = jinja2.Environment(
             auto_reload=options.debug,
             cache_size=options.jinja_template_cache_limit,
             loader=jinja2.FileSystemLoader(get_abs_path(application.app_root, options.jinja_template_root)),
         )
     else:
         self.environment = None
Exemple #5
0
 def __init__(self, application):
     if hasattr(application, 'get_jinja_environment'):
         self.environment = application.get_jinja_environment()
     elif options.jinja_template_root is not None:
         self.environment = jinja2.Environment(
             auto_reload=options.debug,
             cache_size=options.jinja_template_cache_limit,
             loader=jinja2.FileSystemLoader(get_abs_path(application.app_root, options.jinja_template_root)),
         )
     else:
         self.environment = None