diff sat/bridge/dbus_bridge.py @ 3028:ab2696e34d29

Python 3 port: /!\ this is a huge commit /!\ starting from this commit, SàT is needs Python 3.6+ /!\ SàT maybe be instable or some feature may not work anymore, this will improve with time This patch port backend, bridge and frontends to Python 3. Roughly this has been done this way: - 2to3 tools has been applied (with python 3.7) - all references to python2 have been replaced with python3 (notably shebangs) - fixed files not handled by 2to3 (notably the shell script) - several manual fixes - fixed issues reported by Python 3 that where not handled in Python 2 - replaced "async" with "async_" when needed (it's a reserved word from Python 3.7) - replaced zope's "implements" with @implementer decorator - temporary hack to handle data pickled in database, as str or bytes may be returned, to be checked later - fixed hash comparison for password - removed some code which is not needed anymore with Python 3 - deactivated some code which needs to be checked (notably certificate validation) - tested with jp, fixed reported issues until some basic commands worked - ported Primitivus (after porting dependencies like urwid satext) - more manual fixes
author Goffi <goffi@goffi.org>
date Tue, 13 Aug 2019 19:08:41 +0200
parents c7c52c0dc13a
children 2cc2f65379f7
line wrap: on
line diff
--- a/sat/bridge/dbus_bridge.py	Wed Jul 31 11:31:22 2019 +0200
+++ b/sat/bridge/dbus_bridge.py	Tue Aug 13 19:08:41 2019 +0200
@@ -1,4 +1,4 @@
-#!/usr/bin/env python2
+#!/usr/bin/env python3
 # -*- coding: utf-8 -*-
 
 # SAT: a jabber client
@@ -101,11 +101,11 @@
                 raise InternalError
             callback = kwargs.pop("callback")
             errback = kwargs.pop("errback")
-            async = True
+            async_ = True
         else:
-            async = False
+            async_ = False
         result = self.cb[name](*args, **kwargs)
-        if async:
+        if async_:
             if not isinstance(result, Deferred):
                 log.error("Asynchronous method [%s] does not return a Deferred." % name)
                 raise AsyncNotDeferred
@@ -214,73 +214,73 @@
                          in_signature='s', out_signature='a(a{ss}si)',
                          async_callbacks=None)
     def actionsGet(self, profile_key="@DEFAULT@"):
-        return self._callback("actionsGet", unicode(profile_key))
+        return self._callback("actionsGet", str(profile_key))
 
     @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
                          in_signature='ss', out_signature='',
                          async_callbacks=None)
     def addContact(self, entity_jid, profile_key="@DEFAULT@"):
-        return self._callback("addContact", unicode(entity_jid), unicode(profile_key))
+        return self._callback("addContact", str(entity_jid), str(profile_key))
 
     @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
                          in_signature='s', out_signature='',
                          async_callbacks=('callback', 'errback'))
     def asyncDeleteProfile(self, profile, callback=None, errback=None):
-        return self._callback("asyncDeleteProfile", unicode(profile), callback=callback, errback=errback)
+        return self._callback("asyncDeleteProfile", str(profile), callback=callback, errback=errback)
 
     @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
                          in_signature='sssis', out_signature='s',
                          async_callbacks=('callback', 'errback'))
     def asyncGetParamA(self, name, category, attribute="value", security_limit=-1, profile_key="@DEFAULT@", callback=None, errback=None):
-        return self._callback("asyncGetParamA", unicode(name), unicode(category), unicode(attribute), security_limit, unicode(profile_key), callback=callback, errback=errback)
+        return self._callback("asyncGetParamA", str(name), str(category), str(attribute), security_limit, str(profile_key), callback=callback, errback=errback)
 
     @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
                          in_signature='sis', out_signature='a{ss}',
                          async_callbacks=('callback', 'errback'))
     def asyncGetParamsValuesFromCategory(self, category, security_limit=-1, profile_key="@DEFAULT@", callback=None, errback=None):
-        return self._callback("asyncGetParamsValuesFromCategory", unicode(category), security_limit, unicode(profile_key), callback=callback, errback=errback)
+        return self._callback("asyncGetParamsValuesFromCategory", str(category), security_limit, str(profile_key), callback=callback, errback=errback)
 
     @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
                          in_signature='ssa{ss}', out_signature='b',
                          async_callbacks=('callback', 'errback'))
     def connect(self, profile_key="@DEFAULT@", password='', options={}, callback=None, errback=None):
-        return self._callback("connect", unicode(profile_key), unicode(password), options, callback=callback, errback=errback)
+        return self._callback("connect", str(profile_key), str(password), options, callback=callback, errback=errback)
 
     @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
                          in_signature='ss', out_signature='',
                          async_callbacks=('callback', 'errback'))
     def delContact(self, entity_jid, profile_key="@DEFAULT@", callback=None, errback=None):
-        return self._callback("delContact", unicode(entity_jid), unicode(profile_key), callback=callback, errback=errback)
+        return self._callback("delContact", str(entity_jid), str(profile_key), callback=callback, errback=errback)
 
     @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
                          in_signature='asa(ss)bbbbbs', out_signature='(a{sa(sss)}a{sa(sss)}a{sa(sss)})',
                          async_callbacks=('callback', 'errback'))
-    def discoFindByFeatures(self, namespaces, identities, bare_jid=False, service=True, roster=True, own_jid=True, local_device=False, profile_key=u"@DEFAULT@", callback=None, errback=None):
-        return self._callback("discoFindByFeatures", namespaces, identities, bare_jid, service, roster, own_jid, local_device, unicode(profile_key), callback=callback, errback=errback)
+    def discoFindByFeatures(self, namespaces, identities, bare_jid=False, service=True, roster=True, own_jid=True, local_device=False, profile_key="@DEFAULT@", callback=None, errback=None):
+        return self._callback("discoFindByFeatures", namespaces, identities, bare_jid, service, roster, own_jid, local_device, str(profile_key), callback=callback, errback=errback)
 
     @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
                          in_signature='ssbs', out_signature='(asa(sss)a{sa(a{ss}as)})',
                          async_callbacks=('callback', 'errback'))
-    def discoInfos(self, entity_jid, node=u'', use_cache=True, profile_key=u"@DEFAULT@", callback=None, errback=None):
-        return self._callback("discoInfos", unicode(entity_jid), unicode(node), use_cache, unicode(profile_key), callback=callback, errback=errback)
+    def discoInfos(self, entity_jid, node=u'', use_cache=True, profile_key="@DEFAULT@", callback=None, errback=None):
+        return self._callback("discoInfos", str(entity_jid), str(node), use_cache, str(profile_key), callback=callback, errback=errback)
 
     @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
                          in_signature='ssbs', out_signature='a(sss)',
                          async_callbacks=('callback', 'errback'))
-    def discoItems(self, entity_jid, node=u'', use_cache=True, profile_key=u"@DEFAULT@", callback=None, errback=None):
-        return self._callback("discoItems", unicode(entity_jid), unicode(node), use_cache, unicode(profile_key), callback=callback, errback=errback)
+    def discoItems(self, entity_jid, node=u'', use_cache=True, profile_key="@DEFAULT@", callback=None, errback=None):
+        return self._callback("discoItems", str(entity_jid), str(node), use_cache, str(profile_key), callback=callback, errback=errback)
 
     @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
                          in_signature='s', out_signature='',
                          async_callbacks=('callback', 'errback'))
     def disconnect(self, profile_key="@DEFAULT@", callback=None, errback=None):
-        return self._callback("disconnect", unicode(profile_key), callback=callback, errback=errback)
+        return self._callback("disconnect", str(profile_key), callback=callback, errback=errback)
 
     @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
                          in_signature='s', out_signature='s',
                          async_callbacks=None)
     def encryptionNamespaceGet(self, arg_0):
-        return self._callback("encryptionNamespaceGet", unicode(arg_0))
+        return self._callback("encryptionNamespaceGet", str(arg_0))
 
     @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
                          in_signature='', out_signature='aa{ss}',
@@ -291,56 +291,56 @@
     @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
                          in_signature='sss', out_signature='s',
                          async_callbacks=('callback', 'errback'))
-    def encryptionTrustUIGet(self, namespace, arg_1, profile_key, callback=None, errback=None):
-        return self._callback("encryptionTrustUIGet", unicode(namespace), unicode(arg_1), unicode(profile_key), callback=callback, errback=errback)
+    def encryptionTrustUIGet(self, to_jid, namespace, profile_key, callback=None, errback=None):
+        return self._callback("encryptionTrustUIGet", str(to_jid), str(namespace), str(profile_key), callback=callback, errback=errback)
 
     @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
                          in_signature='ss', out_signature='s',
                          async_callbacks=None)
     def getConfig(self, section, name):
-        return self._callback("getConfig", unicode(section), unicode(name))
+        return self._callback("getConfig", str(section), str(name))
 
     @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
                          in_signature='s', out_signature='a(sa{ss}as)',
                          async_callbacks=('callback', 'errback'))
     def getContacts(self, profile_key="@DEFAULT@", callback=None, errback=None):
-        return self._callback("getContacts", unicode(profile_key), callback=callback, errback=errback)
+        return self._callback("getContacts", str(profile_key), callback=callback, errback=errback)
 
     @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
                          in_signature='ss', out_signature='as',
                          async_callbacks=None)
     def getContactsFromGroup(self, group, profile_key="@DEFAULT@"):
-        return self._callback("getContactsFromGroup", unicode(group), unicode(profile_key))
+        return self._callback("getContactsFromGroup", str(group), str(profile_key))
 
     @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
                          in_signature='asass', out_signature='a{sa{ss}}',
                          async_callbacks=None)
     def getEntitiesData(self, jids, keys, profile):
-        return self._callback("getEntitiesData", jids, keys, unicode(profile))
+        return self._callback("getEntitiesData", jids, keys, str(profile))
 
     @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
                          in_signature='sass', out_signature='a{ss}',
                          async_callbacks=None)
     def getEntityData(self, jid, keys, profile):
-        return self._callback("getEntityData", unicode(jid), keys, unicode(profile))
+        return self._callback("getEntityData", str(jid), keys, str(profile))
 
     @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
                          in_signature='s', out_signature='a{sa{ss}}',
                          async_callbacks=('callback', 'errback'))
     def getFeatures(self, profile_key, callback=None, errback=None):
-        return self._callback("getFeatures", unicode(profile_key), callback=callback, errback=errback)
+        return self._callback("getFeatures", str(profile_key), callback=callback, errback=errback)
 
     @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
                          in_signature='ss', out_signature='s',
                          async_callbacks=None)
     def getMainResource(self, contact_jid, profile_key="@DEFAULT@"):
-        return self._callback("getMainResource", unicode(contact_jid), unicode(profile_key))
+        return self._callback("getMainResource", str(contact_jid), str(profile_key))
 
     @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
                          in_signature='ssss', out_signature='s',
                          async_callbacks=None)
     def getParamA(self, name, category, attribute="value", profile_key="@DEFAULT@"):
-        return self._callback("getParamA", unicode(name), unicode(category), unicode(attribute), unicode(profile_key))
+        return self._callback("getParamA", str(name), str(category), str(attribute), str(profile_key))
 
     @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
                          in_signature='', out_signature='as',
@@ -352,13 +352,13 @@
                          in_signature='iss', out_signature='s',
                          async_callbacks=('callback', 'errback'))
     def getParamsUI(self, security_limit=-1, app='', profile_key="@DEFAULT@", callback=None, errback=None):
-        return self._callback("getParamsUI", security_limit, unicode(app), unicode(profile_key), callback=callback, errback=errback)
+        return self._callback("getParamsUI", security_limit, str(app), str(profile_key), callback=callback, errback=errback)
 
     @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
                          in_signature='s', out_signature='a{sa{s(sia{ss})}}',
                          async_callbacks=None)
     def getPresenceStatuses(self, profile_key="@DEFAULT@"):
-        return self._callback("getPresenceStatuses", unicode(profile_key))
+        return self._callback("getPresenceStatuses", str(profile_key))
 
     @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
                          in_signature='', out_signature='',
@@ -376,73 +376,73 @@
                          in_signature='s', out_signature='a{ss}',
                          async_callbacks=None)
     def getWaitingSub(self, profile_key="@DEFAULT@"):
-        return self._callback("getWaitingSub", unicode(profile_key))
+        return self._callback("getWaitingSub", str(profile_key))
 
     @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
                          in_signature='ssiba{ss}s', out_signature='a(sdssa{ss}a{ss}sa{ss})',
                          async_callbacks=('callback', 'errback'))
     def historyGet(self, from_jid, to_jid, limit, between=True, filters='', profile="@NONE@", callback=None, errback=None):
-        return self._callback("historyGet", unicode(from_jid), unicode(to_jid), limit, between, filters, unicode(profile), callback=callback, errback=errback)
+        return self._callback("historyGet", str(from_jid), str(to_jid), limit, between, filters, str(profile), callback=callback, errback=errback)
 
     @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
                          in_signature='s', out_signature='b',
                          async_callbacks=None)
     def isConnected(self, profile_key="@DEFAULT@"):
-        return self._callback("isConnected", unicode(profile_key))
+        return self._callback("isConnected", str(profile_key))
 
     @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
                          in_signature='sa{ss}s', out_signature='a{ss}',
                          async_callbacks=('callback', 'errback'))
     def launchAction(self, callback_id, data, profile_key="@DEFAULT@", callback=None, errback=None):
-        return self._callback("launchAction", unicode(callback_id), data, unicode(profile_key), callback=callback, errback=errback)
+        return self._callback("launchAction", str(callback_id), data, str(profile_key), callback=callback, errback=errback)
 
     @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
                          in_signature='s', out_signature='b',
                          async_callbacks=None)
     def loadParamsTemplate(self, filename):
-        return self._callback("loadParamsTemplate", unicode(filename))
+        return self._callback("loadParamsTemplate", str(filename))
 
     @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
                          in_signature='ss', out_signature='s',
                          async_callbacks=None)
     def menuHelpGet(self, menu_id, language):
-        return self._callback("menuHelpGet", unicode(menu_id), unicode(language))
+        return self._callback("menuHelpGet", str(menu_id), str(language))
 
     @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
                          in_signature='sasa{ss}is', out_signature='a{ss}',
                          async_callbacks=('callback', 'errback'))
     def menuLaunch(self, menu_type, path, data, security_limit, profile_key, callback=None, errback=None):
-        return self._callback("menuLaunch", unicode(menu_type), path, data, security_limit, unicode(profile_key), callback=callback, errback=errback)
+        return self._callback("menuLaunch", str(menu_type), path, data, security_limit, str(profile_key), callback=callback, errback=errback)
 
     @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
                          in_signature='si', out_signature='a(ssasasa{ss})',
                          async_callbacks=None)
     def menusGet(self, language, security_limit):
-        return self._callback("menusGet", unicode(language), security_limit)
+        return self._callback("menusGet", str(language), security_limit)
 
     @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
                          in_signature='ss', out_signature='s',
                          async_callbacks=None)
     def messageEncryptionGet(self, to_jid, profile_key):
-        return self._callback("messageEncryptionGet", unicode(to_jid), unicode(profile_key))
+        return self._callback("messageEncryptionGet", str(to_jid), str(profile_key))
 
     @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
                          in_signature='ssbs', out_signature='',
                          async_callbacks=('callback', 'errback'))
     def messageEncryptionStart(self, to_jid, namespace='', replace=False, profile_key="@NONE@", callback=None, errback=None):
-        return self._callback("messageEncryptionStart", unicode(to_jid), unicode(namespace), replace, unicode(profile_key), callback=callback, errback=errback)
+        return self._callback("messageEncryptionStart", str(to_jid), str(namespace), replace, str(profile_key), callback=callback, errback=errback)
 
     @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
                          in_signature='ss', out_signature='',
                          async_callbacks=('callback', 'errback'))
     def messageEncryptionStop(self, to_jid, profile_key, callback=None, errback=None):
-        return self._callback("messageEncryptionStop", unicode(to_jid), unicode(profile_key), callback=callback, errback=errback)
+        return self._callback("messageEncryptionStop", str(to_jid), str(profile_key), callback=callback, errback=errback)
 
     @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
                          in_signature='sa{ss}a{ss}sa{ss}s', out_signature='',
                          async_callbacks=('callback', 'errback'))
     def messageSend(self, to_jid, message, subject={}, mess_type="auto", extra={}, profile_key="@NONE@", callback=None, errback=None):
-        return self._callback("messageSend", unicode(to_jid), message, subject, unicode(mess_type), extra, unicode(profile_key), callback=callback, errback=errback)
+        return self._callback("messageSend", str(to_jid), message, subject, str(mess_type), extra, str(profile_key), callback=callback, errback=errback)
 
     @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
                          in_signature='', out_signature='a{ss}',
@@ -454,37 +454,37 @@
                          in_signature='sis', out_signature='',
                          async_callbacks=None)
     def paramsRegisterApp(self, xml, security_limit=-1, app=''):
-        return self._callback("paramsRegisterApp", unicode(xml), security_limit, unicode(app))
+        return self._callback("paramsRegisterApp", str(xml), security_limit, str(app))
 
     @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
                          in_signature='sss', out_signature='',
                          async_callbacks=('callback', 'errback'))
     def profileCreate(self, profile, password='', component='', callback=None, errback=None):
-        return self._callback("profileCreate", unicode(profile), unicode(password), unicode(component), callback=callback, errback=errback)
+        return self._callback("profileCreate", str(profile), str(password), str(component), callback=callback, errback=errback)
 
     @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
                          in_signature='s', out_signature='b',
                          async_callbacks=None)
     def profileIsSessionStarted(self, profile_key="@DEFAULT@"):
-        return self._callback("profileIsSessionStarted", unicode(profile_key))
+        return self._callback("profileIsSessionStarted", str(profile_key))
 
     @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
                          in_signature='s', out_signature='s',
                          async_callbacks=None)
     def profileNameGet(self, profile_key="@DEFAULT@"):
-        return self._callback("profileNameGet", unicode(profile_key))
+        return self._callback("profileNameGet", str(profile_key))
 
     @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
                          in_signature='s', out_signature='',
                          async_callbacks=None)
     def profileSetDefault(self, profile):
-        return self._callback("profileSetDefault", unicode(profile))
+        return self._callback("profileSetDefault", str(profile))
 
     @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
                          in_signature='ss', out_signature='b',
                          async_callbacks=('callback', 'errback'))
     def profileStartSession(self, password='', profile_key="@DEFAULT@", callback=None, errback=None):
-        return self._callback("profileStartSession", unicode(password), unicode(profile_key), callback=callback, errback=errback)
+        return self._callback("profileStartSession", str(password), str(profile_key), callback=callback, errback=errback)
 
     @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
                          in_signature='bb', out_signature='as',
@@ -496,61 +496,61 @@
                          in_signature='ss', out_signature='a{ss}',
                          async_callbacks=None)
     def progressGet(self, id, profile):
-        return self._callback("progressGet", unicode(id), unicode(profile))
+        return self._callback("progressGet", str(id), str(profile))
 
     @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
                          in_signature='s', out_signature='a{sa{sa{ss}}}',
                          async_callbacks=None)
     def progressGetAll(self, profile):
-        return self._callback("progressGetAll", unicode(profile))
+        return self._callback("progressGetAll", str(profile))
 
     @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
                          in_signature='s', out_signature='a{sa{sa{ss}}}',
                          async_callbacks=None)
     def progressGetAllMetadata(self, profile):
-        return self._callback("progressGetAllMetadata", unicode(profile))
+        return self._callback("progressGetAllMetadata", str(profile))
 
     @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
                          in_signature='s', out_signature='',
                          async_callbacks=('callback', 'errback'))
     def rosterResync(self, profile_key="@DEFAULT@", callback=None, errback=None):
-        return self._callback("rosterResync", unicode(profile_key), callback=callback, errback=errback)
+        return self._callback("rosterResync", str(profile_key), callback=callback, errback=errback)
 
     @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
                          in_signature='s', out_signature='b',
                          async_callbacks=None)
     def saveParamsTemplate(self, filename):
-        return self._callback("saveParamsTemplate", unicode(filename))
+        return self._callback("saveParamsTemplate", str(filename))
 
     @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
                          in_signature='s', out_signature='a{ss}',
                          async_callbacks=('callback', 'errback'))
     def sessionInfosGet(self, profile_key, callback=None, errback=None):
-        return self._callback("sessionInfosGet", unicode(profile_key), callback=callback, errback=errback)
+        return self._callback("sessionInfosGet", str(profile_key), callback=callback, errback=errback)
 
     @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
                          in_signature='sssis', out_signature='',
                          async_callbacks=None)
     def setParam(self, name, value, category, security_limit=-1, profile_key="@DEFAULT@"):
-        return self._callback("setParam", unicode(name), unicode(value), unicode(category), security_limit, unicode(profile_key))
+        return self._callback("setParam", str(name), str(value), str(category), security_limit, str(profile_key))
 
     @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
                          in_signature='ssa{ss}s', out_signature='',
                          async_callbacks=None)
     def setPresence(self, to_jid='', show='', statuses={}, profile_key="@DEFAULT@"):
-        return self._callback("setPresence", unicode(to_jid), unicode(show), statuses, unicode(profile_key))
+        return self._callback("setPresence", str(to_jid), str(show), statuses, str(profile_key))
 
     @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
                          in_signature='sss', out_signature='',
                          async_callbacks=None)
     def subscription(self, sub_type, entity, profile_key="@DEFAULT@"):
-        return self._callback("subscription", unicode(sub_type), unicode(entity), unicode(profile_key))
+        return self._callback("subscription", str(sub_type), str(entity), str(profile_key))
 
     @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
                          in_signature='ssass', out_signature='',
                          async_callbacks=('callback', 'errback'))
     def updateContact(self, entity_jid, name, groups, profile_key="@DEFAULT@", callback=None, errback=None):
-        return self._callback("updateContact", unicode(entity_jid), unicode(name), groups, unicode(profile_key), callback=callback, errback=errback)
+        return self._callback("updateContact", str(entity_jid), str(name), groups, str(profile_key), callback=callback, errback=errback)
 
     def __attributes(self, in_sign):
         """Return arguments to user given a in_sign
@@ -590,9 +590,9 @@
             i += 1
         return attr
 
-    def addMethod(self, name, int_suffix, in_sign, out_sign, method, async=False):
+    def addMethod(self, name, int_suffix, in_sign, out_sign, method, async_=False):
         """Dynamically add a method to Dbus Bridge"""
-        inspect_args = inspect.getargspec(method)
+        inspect_args = inspect.getfullargspec(method)
 
         _arguments = inspect_args.args
         _defaults = list(inspect_args.defaults or [])
@@ -606,12 +606,12 @@
             [repr(name)]
             + (
                 (_arguments + ["callback=callback", "errback=errback"])
-                if async
+                if async_
                 else _arguments
             )
         )
 
-        if async:
+        if async_:
             _arguments.extend(["callback", "errback"])
             _defaults.extend([None, None])
 
@@ -633,7 +633,7 @@
         )
         exec(code)  # FIXME: to the same thing in a cleaner way, without compile/exec
         method = locals()[name]
-        async_callbacks = ("callback", "errback") if async else None
+        async_callbacks = ("callback", "errback") if async_ else None
         setattr(
             DbusObject,
             name,
@@ -685,7 +685,7 @@
             if e._dbus_error_name == "org.freedesktop.DBus.Error.NotSupported":
                 log.error(
                     _(
-                        u"D-Bus is not launched, please see README to see instructions on how to launch it"
+                        "D-Bus is not launched, please see README to see instructions on how to launch it"
                     )
                 )
             raise BridgeInitError
@@ -744,11 +744,11 @@
         log.debug("registering DBus bridge method [%s]" % name)
         self.dbus_bridge.register_method(name, callback)
 
-    def addMethod(self, name, int_suffix, in_sign, out_sign, method, async=False, doc={}):
+    def addMethod(self, name, int_suffix, in_sign, out_sign, method, async_=False, doc={}):
         """Dynamically add a method to Dbus Bridge"""
         # FIXME: doc parameter is kept only temporary, the time to remove it from calls
         log.debug("Adding method [%s] to DBus bridge" % name)
-        self.dbus_bridge.addMethod(name, int_suffix, in_sign, out_sign, method, async)
+        self.dbus_bridge.addMethod(name, int_suffix, in_sign, out_sign, method, async_)
         self.register_method(name, method)
 
     def addSignal(self, name, int_suffix, signature, doc={}):