comparison sat_frontends/bridge/dbus_bridge.py @ 3039:a1bc34f90fa5

bridge (pb): implemented an asyncio compatible bridge: `pb` bridge can now be used with asyncio by instantiating AIOBridge.
author Goffi <goffi@goffi.org>
date Wed, 25 Sep 2019 08:53:38 +0200
parents ab2696e34d29
children 964abd07dc03
comparison
equal deleted inserted replaced
3038:5f3068915686 3039:a1bc34f90fa5
16 16
17 # You should have received a copy of the GNU Affero General Public License 17 # You should have received a copy of the GNU Affero General Public License
18 # along with this program. If not, see <http://www.gnu.org/licenses/>. 18 # along with this program. If not, see <http://www.gnu.org/licenses/>.
19 19
20 from sat.core.i18n import _ 20 from sat.core.i18n import _
21 from .bridge_frontend import BridgeException 21 from bridge_frontend import BridgeException
22 import dbus 22 import dbus
23 from sat.core.log import getLogger 23 from sat.core.log import getLogger
24 log = getLogger(__name__) 24 log = getLogger(__name__)
25 from sat.core.exceptions import BridgeExceptionNoService, BridgeInitError 25 from sat.core.exceptions import BridgeExceptionNoService, BridgeInitError
26 26
216 if errback is None: 216 if errback is None:
217 errback = log.error 217 errback = log.error
218 error_handler = lambda err:errback(dbus_to_bridge_exception(err)) 218 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
219 return self.db_core_iface.discoFindByFeatures(namespaces, identities, bare_jid, service, roster, own_jid, local_device, profile_key, timeout=const_TIMEOUT, reply_handler=callback, error_handler=error_handler) 219 return self.db_core_iface.discoFindByFeatures(namespaces, identities, bare_jid, service, roster, own_jid, local_device, profile_key, timeout=const_TIMEOUT, reply_handler=callback, error_handler=error_handler)
220 220
221 def discoInfos(self, entity_jid, node='', use_cache=True, profile_key="@DEFAULT@", callback=None, errback=None): 221 def discoInfos(self, entity_jid, node=u'', use_cache=True, profile_key="@DEFAULT@", callback=None, errback=None):
222 if callback is None: 222 if callback is None:
223 error_handler = None 223 error_handler = None
224 else: 224 else:
225 if errback is None: 225 if errback is None:
226 errback = log.error 226 errback = log.error
227 error_handler = lambda err:errback(dbus_to_bridge_exception(err)) 227 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
228 return self.db_core_iface.discoInfos(entity_jid, node, use_cache, profile_key, timeout=const_TIMEOUT, reply_handler=callback, error_handler=error_handler) 228 return self.db_core_iface.discoInfos(entity_jid, node, use_cache, profile_key, timeout=const_TIMEOUT, reply_handler=callback, error_handler=error_handler)
229 229
230 def discoItems(self, entity_jid, node='', use_cache=True, profile_key="@DEFAULT@", callback=None, errback=None): 230 def discoItems(self, entity_jid, node=u'', use_cache=True, profile_key="@DEFAULT@", callback=None, errback=None):
231 if callback is None: 231 if callback is None:
232 error_handler = None 232 error_handler = None
233 else: 233 else:
234 if errback is None: 234 if errback is None:
235 errback = log.error 235 errback = log.error