diff src/bridge/bridge_constructor/dbus_frontend_template.py @ 359:eb9d33ba4e36

bridge: templates' constants can now be overrided
author Goffi <goffi@goffi.org>
date Mon, 06 Jun 2011 18:35:30 +0200
parents 4402ac630712
children 141eeb7cd9e6
line wrap: on
line diff
--- a/src/bridge/bridge_constructor/dbus_frontend_template.py	Mon Jun 06 18:34:40 2011 +0200
+++ b/src/bridge/bridge_constructor/dbus_frontend_template.py	Mon Jun 06 18:35:30 2011 +0200
@@ -23,6 +23,11 @@
 import dbus, dbus.glib
 from logging import debug
 
+const_INT_PREFIX = "org.goffi.SAT"  #Interface prefix
+const_OBJ_PATH = '/org/goffi/SAT/bridge'
+const_COMM_SUFFIX = ".communication"
+const_REQ_SUFFIX = ".request"
+
 class BridgeExceptionNoService(Exception):
     pass
 
@@ -30,12 +35,12 @@
     def __init__(self):
         try:
             self.sessions_bus = dbus.SessionBus()
-            self.db_object = self.sessions_bus.get_object('org.goffi.SAT',
-                                '/org/goffi/SAT/bridge')
+            self.db_object = self.sessions_bus.get_object(const_INT_PREFIX,
+                                const_OBJ_PATH)
             self.db_comm_iface = dbus.Interface(self.db_object,
-                                dbus_interface='org.goffi.SAT.communication')
+                                dbus_interface=const_INT_PREFIX + const_COMM_SUFFIX)
             self.db_req_iface = dbus.Interface(self.db_object,
-                                dbus_interface='org.goffi.SAT.request')
+                                dbus_interface=const_INT_PREFIX + const_REQ_SUFFIX)
         except dbus.exceptions.DBusException,e:
             if e._dbus_error_name=='org.freedesktop.DBus.Error.ServiceUnknown':
                 raise BridgeExceptionNoService