
Fixes cachebust's href() method to take the correct path depending on if it is called by a plugin or wok main page. Signed-off-by: Lucio Correia <luciojhc@linux.vnet.ibm.com> Signed-off-by: Gustavo Y. Ribeiro <gyr@linux.vnet.ibm.com> --- plugins/kimchi/ui/pages/error.html.tmpl | 2 +- src/wok/cachebust.py | 11 ++++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/plugins/kimchi/ui/pages/error.html.tmpl b/plugins/kimchi/ui/pages/error.html.tmpl index 13af1e1..0268200 100644 --- a/plugins/kimchi/ui/pages/error.html.tmpl +++ b/plugins/kimchi/ui/pages/error.html.tmpl @@ -28,7 +28,7 @@ <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <title>Kimchi</title> - <link rel="stylesheet" href="$href("css/theme-default.min.css")"> + <link rel="stylesheet" href="$href('css/theme-default.min.css', 'kimchi')"> </head> diff --git a/src/wok/cachebust.py b/src/wok/cachebust.py index d7cf111..d04b2c6 100644 --- a/src/wok/cachebust.py +++ b/src/wok/cachebust.py @@ -20,11 +20,16 @@ import os -from wok.config import paths +from wok.config import paths, PluginPaths -def href(url): +def href(url, plugin = None): + if plugin is None: + basePath = paths.ui_dir + else: + basePath = PluginPaths(plugin).ui_dir + # for error.html, url is absolute path - f = os.path.join(paths.ui_dir, url.lstrip("/")) + f = os.path.join(basePath, url.lstrip("/")) mtime = os.path.getmtime(f) return "%s?cacheBust=%s" % (url, mtime) -- 1.7.1