def render_from_string(input_string=None, context=None, config=None, template_name=None, input_dictionary=None): jinja2.clear_caches() if config is None: config = {} if template_name is None: template_name = 'input.md' if input_dictionary is None: input_dictionary = {} if input_string is not None: input_dictionary[template_name] = input_string if context is None: context = {} def load_string(template_name): return input_dictionary[template_name] loaders = [FunctionLoader(load_string)] return render_template_to_string(config, template_name, context, loaders=loaders)
def generate_template_output(template_filename, context, loaders=None): first_pass_output = FirstPassOutput() output_line_list = generate_template_output_lines(template_filename, context, loaders, first_pass_output) if first_pass_output.second_pass_is_requested: jinja2.clear_caches() first_pass_output = FirstPassOutput(output_line_list) output_line_list = generate_template_output_lines(template_filename, context, loaders, first_pass_output) return (line for line in output_line_list)
def generate_template_output(config, template_filename, context, loaders=None): environment = _create_jinja_environment(config, loaders) first_pass_output = FirstPassOutput() environment.globals['first_pass_output'] = first_pass_output output_line_list = generate_template_output_lines(environment, template_filename, context) if first_pass_output.second_pass_is_requested: jinja2.clear_caches() first_pass_output_filled = FirstPassOutput(output_line_list) second_pass_environment = _create_jinja_environment(config, loaders) second_pass_environment.globals['first_pass_output'] = first_pass_output_filled output_line_list = generate_template_output_lines(second_pass_environment, template_filename, context) return (line for line in output_line_list)
def handler(self, *args, **kwargs): import jinja2 jinja2.clear_caches()
def setup(self, tmpdir): jinja2.clear_caches()
def GET(self): memcache.flush_all() import jinja2 jinja2.clear_caches() raise web.seeother('/admin/setting')