summaryrefslogtreecommitdiffstats
path: root/python/service.py
diff options
context:
space:
mode:
authorRobert McQueen <robot101@debian.org>2005-11-15 17:19:19 +0000
committerRobert McQueen <robot101@debian.org>2005-11-15 17:19:19 +0000
commitb5e4d26adec0a9ec37a1bae7aeb5a68344b78ebf (patch)
tree66eb4e5670d802aee918f8bd3c4674482de0990c /python/service.py
parentd4595960e9edc679cb2656d3ff59d2f899b0f16b (diff)
2005-11-15 Robert McQueen <robot101@debian.org>
* bus/driver.c, bus/services.c, bus/services.h: Add a ReleaseName method to org.freedesktop.DBus to release a bus name or give up waiting in the queue for it. * dbus/dbus-bus.c, dbus/dbus-bus.h, dbus/dbus-shared.h: Add a dbus_bus_release_name method to send the ReleaseName method calls. Add constants for the return values to dbus/dbus-shared.h. * doc/dbus-specification.xml: Document the new ReleaseName method in the specification. * python/dbus_bindings.pyx: Add a low-level python binding for the release name method. * python/exceptions.py, python/service.py: Make freeing BusName objects release the name. Add a NameExistsException, and fix a bug with creating UnknownMethodException. * test/python/test-client.py: Add tests for freeing BusName objects causing names to be released.
Diffstat (limited to 'python/service.py')
-rw-r--r--python/service.py11
1 files changed, 5 insertions, 6 deletions
diff --git a/python/service.py b/python/service.py
index 6c3561ad..e5a7002b 100644
--- a/python/service.py
+++ b/python/service.py
@@ -1,9 +1,9 @@
-
-import dbus_bindings
+import dbus_bindings
import _dbus
import operator
import traceback
+from exceptions import NameExistsException
from exceptions import UnknownMethodException
from decorators import method
from decorators import signal
@@ -31,13 +31,13 @@ class BusName(object):
# because you can't put flags in, but... who knows?
pass
elif retval == dbus_bindings.REQUEST_NAME_REPLY_EXISTS:
- raise dbus_bindings.DBusException('requested name %s already exists' % name)
+ raise NameExistsException(name)
elif retval == dbus_bindings.REQUEST_NAME_REPLY_ALREADY_OWNER:
# if this is a shared bus which is being used by someone
# else in this process, this can happen legitimately
pass
else:
- raise dbus_bindings.DBusException('requesting name %s returned unexpected value %s' % (name, retval))
+ raise RuntimeError('requesting bus name %s returned unexpected value %s' % (name, retval))
# and create the object
bus_name = object.__new__(cls)
@@ -57,8 +57,7 @@ class BusName(object):
# we can delete the low-level name here because these objects
# are guaranteed to exist only once for each bus name
def __del__(self):
- # FIXME: we don't have this function yet :)
- #dbus_bindings.bus_release_name(self._bus.get_connection(), self._named_service)
+ dbus_bindings.bus_release_name(self._bus.get_connection(), self._name)
pass
def get_bus(self):