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

From: Aline Manera <alinefm@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@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

-- Reviewed-by: Paulo Vital <pvital@linux.vnet.ibm.com> Tested-by: Paulo Vital <pvital@linux.vnet.ibm.com> On Wed, 2014-02-05 at 15:12 -0200, Aline Manera wrote:
From: Aline Manera <alinefm@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@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();
participants (3)
-
Aline Manera
-
Paulo Ricardo Paz Vital
-
Ramon Medeiros