Mercurial > libervia-backend
comparison src/tools/common/template.py @ 2452:7aa863cbc47f
template: remove extension from elements while looking for a path:
this way, extension doesn't need to be provided for a CSS file for a single page.
author | Goffi <goffi@goffi.org> |
---|---|
date | Thu, 30 Nov 2017 20:58:34 +0100 |
parents | d294527bd46f |
children | 84e84a46b014 |
comparison
equal
deleted
inserted
replaced
2451:d1153ce68ca0 | 2452:7aa863cbc47f |
---|---|
297 return file_ | 297 return file_ |
298 | 298 |
299 def getThemeData(self, template_path): | 299 def getThemeData(self, template_path): |
300 """return template data got from template_path | 300 """return template data got from template_path |
301 | 301 |
302 @return tuple(unicde, unicode, bool): | 302 @return tuple(unicode, unicode, bool): |
303 path_elems: elements of the path | 303 path_elems: elements of the path |
304 theme: theme of the page | 304 theme: theme of the page |
305 is_default: True if the theme is the default theme | 305 is_default: True if the theme is the default theme |
306 """ | 306 """ |
307 path_elems = template_path.split(u'/') | 307 path_elems = [os.path.splitext(p)[0] for p in template_path.split(u'/')] |
308 theme = path_elems.pop(0) | 308 theme = path_elems.pop(0) |
309 is_default = theme == C.TEMPLATE_THEME_DEFAULT | 309 is_default = theme == C.TEMPLATE_THEME_DEFAULT |
310 return (path_elems, theme, is_default) | 310 return (path_elems, theme, is_default) |
311 | 311 |
312 def getCSSFiles(self, template_path, template_root_dir): | 312 def getCSSFiles(self, template_path, template_root_dir): |