[Kimchi-devel] [PATCH] bug fix: Set full path to guest page file in guest tab

Aline Manera alinefm at linux.vnet.ibm.com
Wed Feb 5 17:12:19 UTC 2014


From: Aline Manera <alinefm at br.ibm.com>

Commit 6bcbb3f0 changed how the guest tab is loaded to be more robust, but it
was using relative path to guest page which causes errors when Kimchi is
running outside its top directory.
So use full path to avoid those kind of problems.

Signed-off-by: Aline Manera <alinefm at br.ibm.com>
---
 src/kimchi/root.py             |    8 +++++++-
 ui/pages/tabs/guests.html.tmpl |    2 +-
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/kimchi/root.py b/src/kimchi/root.py
index c3d471e..ce4a49c 100644
--- a/src/kimchi/root.py
+++ b/src/kimchi/root.py
@@ -75,8 +75,14 @@ class Root(Resource):
 
     @cherrypy.expose
     def tabs(self, page, **kwargs):
+        # In order to load the Guests tab, we also use Cheetah in the tab
+        # template to save the delay of the extra get to the guest page
+        # For that, the tab template needs to know the correct path to ui files
+        data = {}
+        data['ui_dir'] = paths.ui_dir
+
         if page.endswith('.html'):
-            return template.render('tabs/' + page, None)
+            return template.render('tabs/' + page, data)
         raise cherrypy.HTTPError(404)
 
 
diff --git a/ui/pages/tabs/guests.html.tmpl b/ui/pages/tabs/guests.html.tmpl
index e2ab173..8b530c7 100644
--- a/ui/pages/tabs/guests.html.tmpl
+++ b/ui/pages/tabs/guests.html.tmpl
@@ -52,7 +52,7 @@
         $_("No guests found.")
     </div>
     <script id="guest-tmpl" type="kimchi/template">
-    $ht(file="ui/pages/guest.html.tmpl",searchList=[self,{'lang':$lang}])
+    $ht(file=$data.ui_dir + "/pages/guest.html.tmpl", searchList=[self, {'lang':$lang}])
     </script>
     <script type="text/javascript">
         kimchi.guest_main();
-- 
1.7.10.4




More information about the Kimchi-devel mailing list