# HG changeset patch # User Goffi # Date 1509086184 -7200 # Node ID 7bfcc431f66d7c8f259e459ebde7474848bd0b67 # Parent 8ed4ac10cb5e4d0de26e9b91cf428912d5d6e26a template: added media_path to template data diff -r 8ed4ac10cb5e -r 7bfcc431f66d src/tools/common/template.py --- 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)