summaryrefslogtreecommitdiff
path: root/dbus/bus.py
diff options
context:
space:
mode:
authorBarry Warsaw <barry@python.org>2011-12-15 06:57:21 -0500
committerBarry Warsaw <barry@python.org>2011-12-15 06:57:21 -0500
commit4c1c2eade1c5b383adad94a7a4fd6553873fecf0 (patch)
treeb9e0f45fc19539bcaddff69e661bf0c5d21bab5a /dbus/bus.py
parent667082d0b4aef9c438a2e7fec89614b5b8ef960a (diff)
downloaddbus-python-4c1c2eade1c5b383adad94a7a4fd6553873fecf0.tar.gz
This is the big one; it adds Python 3 support.
Diffstat (limited to 'dbus/bus.py')
-rw-r--r--dbus/bus.py23
1 files changed, 18 insertions, 5 deletions
diff --git a/dbus/bus.py b/dbus/bus.py
index 9f77717..109f4c6 100644
--- a/dbus/bus.py
+++ b/dbus/bus.py
@@ -39,6 +39,7 @@ from _dbus_bindings import (
from dbus.connection import Connection
from dbus.exceptions import DBusException
from dbus.lowlevel import HANDLER_RESULT_NOT_YET_HANDLED
+from dbus._compat import is_py2
_NAME_OWNER_CHANGE_MATCH = ("type='signal',sender='%s',"
@@ -77,13 +78,16 @@ class NameOwnerWatch(object):
BUS_DAEMON_NAME,
BUS_DAEMON_PATH,
arg0=bus_name)
+ keywords = {}
+ if is_py2:
+ keywords['utf8_strings'] = True
self._pending_call = bus_conn.call_async(BUS_DAEMON_NAME,
BUS_DAEMON_PATH,
BUS_DAEMON_IFACE,
'GetNameOwner',
's', (bus_name,),
callback, error_cb,
- utf8_strings=True)
+ **keywords)
def cancel(self):
if self._match is not None:
@@ -230,7 +234,7 @@ class BusConnection(Connection):
bus_name = named_service
if kwargs:
raise TypeError('get_object does not take these keyword '
- 'arguments: %s' % ', '.join(kwargs.iterkeys()))
+ 'arguments: %s' % ', '.join(kwargs.keys()))
return self.ProxyObjectClass(self, bus_name, object_path,
introspect=introspect,
@@ -321,9 +325,12 @@ class BusConnection(Connection):
:Returns: a dbus.Array of dbus.UTF8String
:Since: 0.81.0
"""
+ keywords = {}
+ if is_py2:
+ keywords['utf8_strings'] = True
return self.call_blocking(BUS_DAEMON_NAME, BUS_DAEMON_PATH,
BUS_DAEMON_IFACE, 'ListNames',
- '', (), utf8_strings=True)
+ '', (), **keywords)
def list_activatable_names(self):
"""Return a list of all names that can be activated on the bus.
@@ -331,9 +338,12 @@ class BusConnection(Connection):
:Returns: a dbus.Array of dbus.UTF8String
:Since: 0.81.0
"""
+ keywords = {}
+ if is_py2:
+ keywords['utf8_strings'] = True
return self.call_blocking(BUS_DAEMON_NAME, BUS_DAEMON_PATH,
BUS_DAEMON_IFACE, 'ListActivatableNames',
- '', (), utf8_strings=True)
+ '', (), **keywords)
def get_name_owner(self, bus_name):
"""Return the unique connection name of the primary owner of the
@@ -342,10 +352,13 @@ class BusConnection(Connection):
:Raises `DBusException`: if the `bus_name` has no owner
:Since: 0.81.0
"""
+ keywords = {}
+ if is_py2:
+ keywords['utf8_strings'] = True
validate_bus_name(bus_name, allow_unique=False)
return self.call_blocking(BUS_DAEMON_NAME, BUS_DAEMON_PATH,
BUS_DAEMON_IFACE, 'GetNameOwner',
- 's', (bus_name,), utf8_strings=True)
+ 's', (bus_name,), **keywords)
def watch_name_owner(self, bus_name, callback):
"""Watch the unique connection name of the primary owner of the