search for xoslib dashboards
diff --git a/planetstack/core/dashboard/views/home.py b/planetstack/core/dashboard/views/home.py
index 6cb25a0..e6f77fd 100644
--- a/planetstack/core/dashboard/views/home.py
+++ b/planetstack/core/dashboard/views/home.py
@@ -26,14 +26,21 @@
return self.singleDashboardView(request, name, context)
def readTemplate(self, fn):
- try:
- template= open("/opt/planetstack/templates/admin/dashboard/%s.html" % fn, "r").read()
- if (fn=="tenant"):
- # fix for tenant view - it writes html to a div called tabs-5
- template = '<div id="tabs-5"></div>' + template
- return template
- except:
- return "failed to open %s" % fn
+ TEMPLATE_DIRS = ["/opt/planetstack/templates/admin/dashboard/",
+ "/opt/planetstack/core/xoslib/dashboards/"]
+
+ for template_dir in TEMPLATE_DIRS:
+ pathname = os.path.join(template_dir, fn) + ".html"
+ if os.path.exists(pathname):
+ break
+ else:
+ return "failed to find %s in %s" % (fn, TEMPLATE_DIRS)
+
+ template= open(pathname, "r").read()
+ if (fn=="tenant"):
+ # fix for tenant view - it writes html to a div called tabs-5
+ template = '<div id="tabs-5"></div>' + template
+ return template
def embedDashboard(self, url):
if url.startswith("template:"):