diff src/browser/libervia_main.py @ 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 ec77c2bc18d3
children 14bdf5394ae9
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"))