core: use of the new core.log module:
/!\ this is a massive refactoring and was largely automated, it probably did bring some bugs /!\
This commit is contained in:
parent
dc5c042fe7
commit
501bc92528
1 changed files with 707 additions and 941 deletions
|
|
@ -19,7 +19,8 @@
|
|||
|
||||
from sat.core.i18n import _, D_
|
||||
from sat.core.constants import Const as C
|
||||
from logging import debug, info, warning, error
|
||||
from sat.core.log import getLogger
|
||||
log = getLogger(__name__)
|
||||
from twisted.words.protocols.jabber import jid
|
||||
from twisted.internet import defer, reactor
|
||||
from wokkel import data_form
|
||||
|
|
@ -53,7 +54,7 @@ PLUGIN_INFO = {
|
|||
class AdHocDBus(object):
|
||||
|
||||
def __init__(self, host):
|
||||
info(_("plugin Ad-Hoc D-Bus initialization"))
|
||||
log.info(_("plugin Ad-Hoc D-Bus initialization"))
|
||||
self.host = host
|
||||
host.bridge.addMethod("adHocDBusAddAuto", ".plugin", in_sign='sasasasasasass', out_sign='(sa(sss))',
|
||||
method=self._adHocDBusAddAuto,
|
||||
|
|
@ -97,7 +98,7 @@ class AdHocDBus(object):
|
|||
|
||||
@defer.inlineCallbacks
|
||||
def _introspect(self, methods, bus_name, proxy):
|
||||
debug("introspecting path [%s]" % proxy.object_path)
|
||||
log.debug("introspecting path [%s]" % proxy.object_path)
|
||||
introspect_xml = yield self._DBusIntrospect(proxy)
|
||||
el = etree.fromstring(introspect_xml)
|
||||
for node in el.iterchildren('node', 'interface'):
|
||||
|
|
@ -108,13 +109,13 @@ class AdHocDBus(object):
|
|||
elif node.tag == 'interface':
|
||||
name = node.get('name')
|
||||
if any(name.startswith(ignored) for ignored in IGNORED_IFACES_START):
|
||||
debug('interface [%s] is ignored' % name)
|
||||
log.debug('interface [%s] is ignored' % name)
|
||||
continue
|
||||
debug("introspecting interface [%s]" % name)
|
||||
log.debug("introspecting interface [%s]" % name)
|
||||
for method in node.iterchildren('method'):
|
||||
if self._acceptMethod(method):
|
||||
method_name = method.get('name')
|
||||
debug("method accepted: [%s]" % method_name)
|
||||
log.debug("method accepted: [%s]" % method_name)
|
||||
methods.add((proxy.object_path, name, method_name))
|
||||
|
||||
def _adHocDBusAddAuto(self, prog_name, allowed_jids, allowed_groups, allowed_magics, forbidden_jids, forbidden_groups, flags, profile_key):
|
||||
|
|
@ -125,13 +126,13 @@ class AdHocDBus(object):
|
|||
bus_names = yield self._DBusListNames()
|
||||
bus_names = [bus_name for bus_name in bus_names if '.' + prog_name in bus_name]
|
||||
if not bus_names:
|
||||
info("Can't find any bus for [%s]" % prog_name)
|
||||
log.info("Can't find any bus for [%s]" % prog_name)
|
||||
return
|
||||
bus_names.sort()
|
||||
for bus_name in bus_names:
|
||||
if bus_name.endswith(prog_name):
|
||||
break
|
||||
info("bus name found: [%s]" % bus_name)
|
||||
log.info("bus name found: [%s]" % bus_name)
|
||||
proxy = self.session_bus.get_object(bus_name, '/', introspect=False)
|
||||
methods = set()
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue