summaryrefslogtreecommitdiff
path: root/dbus/service.py
diff options
context:
space:
mode:
authorSimon McVittie <simon.mcvittie@collabora.co.uk>2007-07-18 21:26:10 +0100
committerSimon McVittie <simon.mcvittie@collabora.co.uk>2007-07-18 21:26:10 +0100
commitf5eb61dce982d6c51a78f5bb745ebd632ef1ad70 (patch)
tree7d968a425c14136fc324de034770ce14a5bb742d /dbus/service.py
parent4cab9350dda0b36446d7b2a935bd6451a38e67a2 (diff)
Try to avoid importing things from _dbus_bindings when they could be imported from public API
Diffstat (limited to 'dbus/service.py')
-rw-r--r--dbus/service.py28
1 files changed, 14 insertions, 14 deletions
diff --git a/dbus/service.py b/dbus/service.py
index 5e7d4c9..21f0da8 100644
--- a/dbus/service.py
+++ b/dbus/service.py
@@ -32,12 +32,13 @@ except ImportError:
import dummy_thread as thread
import _dbus_bindings
-from dbus import SessionBus
+from dbus import SessionBus, Signature, Struct, validate_bus_name, \
+ validate_object_path
+from dbus.decorators import method, signal
from dbus.exceptions import DBusException, \
NameExistsException, \
UnknownMethodException
-from dbus.decorators import method
-from dbus.decorators import signal
+from dbus.lowlevel import ErrorMessage, MethodReturnMessage
from dbus.proxies import LOCAL_PATH
@@ -100,8 +101,7 @@ class BusName(object):
services waiting for the requested name if another service
already holds it.
"""
- _dbus_bindings.validate_bus_name(name, allow_well_known=True,
- allow_unique=False)
+ validate_bus_name(name, allow_well_known=True, allow_unique=False)
# if necessary, get default bus (deprecated)
if bus is None:
@@ -243,7 +243,7 @@ def _method_lookup(self, method_name, dbus_interface):
def _method_reply_return(connection, message, method_name, signature, *retval):
- reply = _dbus_bindings.MethodReturnMessage(message)
+ reply = MethodReturnMessage(message)
try:
reply.append(signature=signature, *retval)
except Exception, e:
@@ -273,7 +273,7 @@ def _method_reply_error(connection, message, exception):
name = 'org.freedesktop.DBus.Python.%s.%s' % (exception.__module__, exception.__class__.__name__)
contents = traceback.format_exc()
- reply = _dbus_bindings.ErrorMessage(message, name, contents)
+ reply = ErrorMessage(message, name, contents)
connection.send_message(reply)
@@ -312,15 +312,15 @@ class InterfaceType(type):
# convert signature into a tuple so length refers to number of
# types, not number of characters. the length is checked by
# the decorator to make sure it matches the length of args.
- in_sig = tuple(_dbus_bindings.Signature(func._dbus_in_signature))
+ in_sig = tuple(Signature(func._dbus_in_signature))
else:
# magic iterator which returns as many v's as we need
in_sig = _VariantSignature()
if func._dbus_out_signature:
- out_sig = _dbus_bindings.Signature(func._dbus_out_signature)
+ out_sig = Signature(func._dbus_out_signature)
else:
- # its tempting to default to _dbus_bindings.Signature('v'), but
+ # its tempting to default to Signature('v'), but
# for methods that return nothing, providing incorrect
# introspection data is worse than providing none at all
out_sig = []
@@ -340,7 +340,7 @@ class InterfaceType(type):
if func._dbus_signature:
# convert signature into a tuple so length refers to number of
# types, not number of characters
- sig = tuple(_dbus_bindings.Signature(func._dbus_signature))
+ sig = tuple(Signature(func._dbus_signature))
else:
# magic iterator which returns as many v's as we need
sig = _VariantSignature()
@@ -431,7 +431,7 @@ class Object(Interface):
Object's lifetime (unless it's released manually).
"""
if object_path is not None:
- _dbus_bindings.validate_object_path(object_path)
+ validate_object_path(object_path)
if isinstance(conn, BusName):
# someone's using the old API; don't gratuitously break them
@@ -638,7 +638,7 @@ class Object(Interface):
keywords = {}
if parent_method._dbus_out_signature is not None:
- signature = _dbus_bindings.Signature(parent_method._dbus_out_signature)
+ signature = Signature(parent_method._dbus_out_signature)
else:
signature = None
@@ -696,7 +696,7 @@ class Object(Interface):
if retval is None:
retval = ()
elif (isinstance(retval, tuple)
- and not isinstance(retval, _dbus_bindings.Struct)):
+ and not isinstance(retval, Struct)):
# If the return is a tuple that is not a Struct, we use it
# as-is on the assumption that there are multiple return
# values - this is the usual Python idiom. (fd.o #10174)