summaryrefslogtreecommitdiff
path: root/dbus/_dbus.py
diff options
context:
space:
mode:
authorSimon McVittie <smcv@celebrin.pseudorandom.co.uk>2006-11-22 18:18:13 +0000
committerSimon McVittie <smcv@celebrin.pseudorandom.co.uk>2006-11-22 18:18:13 +0000
commit5bcdc1378cceb0885fc2138e55259f15a83fa1ce (patch)
tree294b74ca62fbb0eb5e31170ffc9181dd0c35f03a /dbus/_dbus.py
parent08971243466ab63ea19a20a1c1f1fd0d98714541 (diff)
downloaddbus-python-5bcdc1378cceb0885fc2138e55259f15a83fa1ce.tar.gz
Add short-term backwards compatibility with dbus_bindings (various programs try to catch dbus_bindings.DBusException)
Diffstat (limited to 'dbus/_dbus.py')
-rw-r--r--dbus/_dbus.py34
1 files changed, 34 insertions, 0 deletions
diff --git a/dbus/_dbus.py b/dbus/_dbus.py
index ea01457..f98ed72 100644
--- a/dbus/_dbus.py
+++ b/dbus/_dbus.py
@@ -516,3 +516,37 @@ class Interface:
return '<Interface %r implementing %r at %#x>'%(
self._obj, self._dbus_interface, id(self))
__str__ = __repr__
+
+
+_dbus_bindings_warning = DeprecationWarning("""\
+The dbus_bindings module is deprecated and will go away soon.
+
+dbus-python 0.80 provides only a partial emulation of the old
+dbus_bindings, which was never meant to be public API.
+
+Most uses of dbus_bindings are applications catching the exception
+dbus.dbus_bindings.DBusException. You should use dbus.DBusException
+instead (this is compatible with all dbus-python versions since 0.40.2).
+
+If you need additional public API, please contact the maintainers via
+<dbus@lists.freedesktop.org>.
+""")
+
+class _DBusBindingsEmulation:
+ """A partial emulation of the dbus_bindings module."""
+ _module = None
+ def __str__(self):
+ return '_DBusBindingsEmulation()'
+ def __repr__(self):
+ return '_DBusBindingsEmulation()'
+ def __getattr__(self, attr):
+ from warnings import warn as _warn
+ _warn(_dbus_bindings_warning, DeprecationWarning, stacklevel=2)
+
+ if self._module is None:
+ import dbus.dbus_bindings as m
+ self._module = m
+ return getattr(self._module, attr)
+
+dbus_bindings = _DBusBindingsEmulation()
+"""Deprecated, don't use."""