Mercurial > libervia-backend
diff src/tools/common/template.py @ 2394:7bfcc431f66d
template: added media_path to template data
author | Goffi <goffi@goffi.org> |
---|---|
date | Fri, 27 Oct 2017 08:36:24 +0200 |
parents | 07e1543d6992 |
children | 221478058d8a |
line wrap: on
line diff
--- a/src/tools/common/template.py Fri Oct 27 08:35:22 2017 +0200 +++ b/src/tools/common/template.py Fri Oct 27 08:36:24 2017 +0200 @@ -377,13 +377,15 @@ # jinja use string when no special char is used, so we have to convert to unicode return unicode(template).format(value=value, **kwargs) - def render(self, template, theme=None, locale=DEFAULT_LOCALE, root_path=u'', css_files=None, css_inline=False, **kwargs): + def render(self, template, theme=None, locale=DEFAULT_LOCALE, root_path=u'', media_path=u'', css_files=None, css_inline=False, **kwargs): """render a template @param template(unicode): template to render (e.g. blog/articles.html) @param theme(unicode): template theme @param root_path(unicode): prefix of the path/URL to use for template root must end with a u'/' + @param media_path(unicode): prefix of the SàT media path/URL to use for template root + must end with a u'/' @param css_files(list[unicode],None): CSS files to used CSS files must be in static dir of the template use None for automatic selection of CSS files based on template category @@ -424,4 +426,4 @@ self.setLocale(locale) # XXX: theme used in template arguments is the requested theme, which may differ from actual theme # if the template doesn't exist in the requested theme. - return template_source.render(theme=theme, root_path=root_path, css_files=css_files, locale=self._locale, gidx=Indexer(), script=scripts_handler, **kwargs) + return template_source.render(theme=theme, root_path=root_path, media_path=media_path, css_files=css_files, locale=self._locale, gidx=Indexer(), script=scripts_handler, **kwargs)