From a2f7458105791f37be52e1de22b710968904b235 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Wed, 20 Jun 2007 18:01:19 +0100 Subject: [PATCH] dbus.service: Deprecate the omission of the `bus` argument in the BusName constructor. Explicit is better than implicit. --- dbus/service.py | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/dbus/service.py b/dbus/service.py index d7b3a74..8bb96c6 100644 --- a/dbus/service.py +++ b/dbus/service.py @@ -82,8 +82,13 @@ class BusName(object): `name` : str The well-known name to be advertised `bus` : dbus.Bus - A Bus on which this service will be advertised; if None - (default) the session bus will be used + A Bus on which this service will be advertised. + + Omitting this parameter or setting it to None has been + deprecated since version 0.82.1. For backwards compatibility, + if this is done, the global shared connection to the session + bus will be used. + `allow_replacement` : bool If True, other processes trying to claim the same well-known name will take precedence over this one. @@ -98,8 +103,12 @@ class BusName(object): _dbus_bindings.validate_bus_name(name, allow_well_known=True, allow_unique=False) - # get default bus - if bus == None: + # if necessary, get default bus (deprecated) + if bus is None: + import warnings + warnings.warn('Omitting the "bus" parameter to ' + 'dbus.service.BusName.__init__ is deprecated', + DeprecationWarning) bus = SessionBus() # see if this name is already defined, return it if so -- 2.11.4.GIT