[Kimchi-devel] [PATCH V3 24/34] Make cachebust's href() plugin-aware

Lucio Correia luciojhc at linux.vnet.ibm.com
Wed Jul 8 19:17:56 UTC 2015


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 at linux.vnet.ibm.com>
Signed-off-by: Gustavo Y. Ribeiro <gyr at linux.vnet.ibm.com>
---
 src/wok/cachebust.py |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)

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




More information about the Kimchi-devel mailing list