Mercurial > libervia-web
changeset 613:deddd1cd8aa5 frontends_multi_profiles
browser side: added a base_location property to get location of current Libervia instance
author | Goffi <goffi@goffi.org> |
---|---|
date | Tue, 10 Feb 2015 20:42:39 +0100 |
parents | 5983d6be4f07 |
children | 14bdf5394ae9 |
files | src/browser/libervia_main.py src/common/constants.py src/server/server.py |
diffstat | 3 files changed, 13 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/browser/libervia_main.py Tue Feb 10 19:38:28 2015 +0100 +++ b/src/browser/libervia_main.py Tue Feb 10 20:42:39 2015 +0100 @@ -112,6 +112,16 @@ def contact_list(self): return self.contact_lists[C.PROF_KEY_NONE] + @property + def base_location(self): + """Return absolute base url of this Libervia instance""" + url = Window.getLocation().getHref() + if url.endswith(C.LIBERVIA_MAIN_PAGE): + url = url[:-len(C.LIBERVIA_MAIN_PAGE)] + if url.endswith("/"): + url = url[:-1] + return url + def registerSignal(self, functionName, handler=None, iface="core", with_profile=True): if handler is None: callback = getattr(self, "{}{}".format(functionName, "Handler"))
--- a/src/common/constants.py Tue Feb 10 19:38:28 2015 +0100 +++ b/src/common/constants.py Tue Feb 10 20:42:39 2015 +0100 @@ -24,6 +24,8 @@ class Const(constants.Const): + LIBERVIA_MAIN_PAGE = "libervia.html" + # Frontend parameters COMPOSITION_KEY = D_("Composition") ENABLE_UNIBOX_PARAM = D_("Enable unibox")
--- a/src/server/server.py Tue Feb 10 19:38:28 2015 +0100 +++ b/src/server/server.py Tue Feb 10 20:42:39 2015 +0100 @@ -1107,7 +1107,7 @@ """Add a child to the root resource""" root.putChild(path, EncodingResourceWrapper(resource, [server.GzipEncoderFactory()])) - putChild('', Redirect('libervia.html')) + putChild('', Redirect(C.LIBERVIA_MAIN_PAGE)) putChild('test', Redirect('libervia_test.html')) putChild('json_signal_api', self.signal_handler) putChild('json_api', MethodHandler(self))