diff --git a/Lodel/settings_format.py b/Lodel/settings_format.py index 2f74f64..99c9cb1 100644 --- a/Lodel/settings_format.py +++ b/Lodel/settings_format.py @@ -19,4 +19,5 @@ MANDATORY = [ ALLOWED = [ 'em_graph_output', 'em_graph_format', + 'templates_base_dir' ] diff --git a/Template/Loader.py b/Template/Loader.py index 98b7b43..620c19b 100644 --- a/Template/Loader.py +++ b/Template/Loader.py @@ -21,12 +21,13 @@ class TemplateLoader(object): # @param template_file str : path to the template file (starting from the base path used to instanciate the # TemplateLoader) # @param template_vars dict : parameters to be used in the template + # @param template_extra list : list of custom modules to import in the template (default value : None) # @return str. String containing the HTML output of the processed templated - def render_to_html(self, template_file, template_vars={}, template_extra={}): + def render_to_html(self, template_file, template_vars={}, template_extra=None): loader = jinja2.FileSystemLoader(searchpath=self.search_path, followlinks=self.follow_links) environment = jinja2.Environment(loader=loader) template = environment.get_template(template_file) - if template_extra is not None or template_extra != {}: + if template_extra is not None: for extra in template_extra: template.globals[extra[0]] = extra[1] return template.render(template_vars) diff --git a/install/instance_settings.py b/install/instance_settings.py index 476a227..e61d4d3 100644 --- a/install/instance_settings.py +++ b/install/instance_settings.py @@ -1,10 +1,13 @@ #-*- coding:utf8 -*- import pymysql +import os sitename = 'LODEL2_INSTANCE_NAME' lodel2_lib_path = 'LODEL2_LIB_ABS_PATH' +templates_base_dir = 'LODEL2_INSTANCE_TEMPLATES_BASE_DIR' + debug = False em_file = 'em.json'