Before this patch, a plugin could only extend anothers tab content.
With this patch, a plugin can extend any HTML page from others.
This is needed due the Ginger sidebar and Ginger s390x dependency.
Signed-off-by: Aline Manera <alinefm@linux.vnet.ibm.com>
---
src/wok/root.py | 19 ++++++++++++-------
1 file changed, 12 insertions(+), 7 deletions(-)
diff --git a/src/wok/root.py b/src/wok/root.py
index c01c7d1..ea88c8c 100644
--- a/src/wok/root.py
+++ b/src/wok/root.py
@@ -101,6 +101,7 @@ class Root(Resource):
@cherrypy.expose
def default(self, page, **kwargs):
+ kwargs['scripts'] = self._get_scripts(page)
if page.endswith('.html'):
return template.render(page, kwargs)
if page.endswith('.json'):
@@ -121,13 +122,7 @@ class Root(Resource):
data = {}
data['ui_dir'] = paths.ui_dir
-
- data['scripts'] = []
- for plugin, app in cherrypy.tree.apps.iteritems():
- if app.root.extends is not None:
- scripts = app.root.extends.get(script_name, {})
- if page in scripts.keys():
- data['scripts'].append(scripts[page])
+ data['scripts'] = self._get_scripts(page)
if page.endswith('.html'):
context = template.render('/tabs/' + page, data)
@@ -136,6 +131,16 @@ class Root(Resource):
return context
raise cherrypy.HTTPError(404)
+ def _get_scripts(self, page):
+ result = []
+ script_name = cherrypy.request.app.script_name or "/"
+ for plugin, app in cherrypy.tree.apps.iteritems():
+ if app.root.extends is not None:
+ scripts = app.root.extends.get(script_name, {})
+ if page in scripts.keys():
+ result.append(scripts[page])
+ return result
+
class WokRoot(Root):
def __init__(self, model, dev_env=False):
--
2.9.3
_______________________________________________
Kimchi-devel mailing list
Kimchi-devel@ovirt.org
http://lists.ovirt.org/mailman/listinfo/kimchi-devel
Applied. Thanks. Regards, Aline Manera _______________________________________________ Kimchi-devel mailing list Kimchi-devel@ovirt.org http://lists.ovirt.org/mailman/listinfo/kimchi-devel
Reviewed-by: Daniel Barboza <danielhb@linux.vnet.ibm.com>
Tested-by: Daniel Barboza <danielhb@linux.vnet.ibm.com>
On 03/02/2017 10:12 PM, Aline Manera wrote:
> Before this patch, a plugin could only extend anothers tab content.
> With this patch, a plugin can extend any HTML page from others.
>
> This is needed due the Ginger sidebar and Ginger s390x dependency.
>
> Signed-off-by: Aline Manera <alinefm@linux.vnet.ibm.com>
> ---
> src/wok/root.py | 19 ++++++++++++-------
> 1 file changed, 12 insertions(+), 7 deletions(-)
>
> diff --git a/src/wok/root.py b/src/wok/root.py
> index c01c7d1..ea88c8c 100644
> --- a/src/wok/root.py
> +++ b/src/wok/root.py
> @@ -101,6 +101,7 @@ class Root(Resource):
>
> @cherrypy.expose
> def default(self, page, **kwargs):
> + kwargs['scripts'] = self._get_scripts(page)
> if page.endswith('.html'):
> return template.render(page, kwargs)
> if page.endswith('.json'):
> @@ -121,13 +122,7 @@ class Root(Resource):
>
> data = {}
> data['ui_dir'] = paths.ui_dir
> -
> - data['scripts'] = []
> - for plugin, app in cherrypy.tree.apps.iteritems():
> - if app.root.extends is not None:
> - scripts = app.root.extends.get(script_name, {})
> - if page in scripts.keys():
> - data['scripts'].append(scripts[page])
> + data['scripts'] = self._get_scripts(page)
>
> if page.endswith('.html'):
> context = template.render('/tabs/' + page, data)
> @@ -136,6 +131,16 @@ class Root(Resource):
> return context
> raise cherrypy.HTTPError(404)
>
> + def _get_scripts(self, page):
> + result = []
> + script_name = cherrypy.request.app.script_name or "/"
> + for plugin, app in cherrypy.tree.apps.iteritems():
> + if app.root.extends is not None:
> + scripts = app.root.extends.get(script_name, {})
> + if page in scripts.keys():
> + result.append(scripts[page])
> + return result
> +
>
> class WokRoot(Root):
> def __init__(self, model, dev_env=False):
_______________________________________________
Kimchi-devel mailing list
Kimchi-devel@ovirt.org
http://lists.ovirt.org/mailman/listinfo/kimchi-devel
© 2016 - 2026 Red Hat, Inc.