+2005-05-04 John (J5) Palmieir <johnp@redhat.com>
+
+ * python/Makefile.am: changed to use pyexecdir for the binding
+ shared libraries (Bug#2494)
+
+ * python/exceptions.py: bring exceptions over from the bindings
+ so they can be used in applications (Bug#2036)
+ Make all exceptions derive from DBusException
+
+ * python/_dbus.py, python/proxies.py: implement __repr__ in a couple
+ of classes so that print obj doesn't throw an exception (Bug #1685)
+
2005-05-03 Ross Burton <ross@burtonini.com>
* glib/dbus-gobject.c (dbus_g_connection_register_g_object):
dbusdir = $(pythondir)/dbus
dbus_PYTHON = __init__.py _dbus.py decorators.py exceptions.py services.py proxies.py _util.py types.py
-dbusbindingsdir = $(pythondir)/dbus
+dbusbindingsdir = $(pyexecdir)/dbus
dbusbindings_LTLIBRARIES = dbus_bindings.la
dbus_bindings_la_LDFLAGS = -module -avoid-version -fPIC -export-symbols-regex initdbus_bindings
def __init__(self):
Bus.__init__(self, Bus.TYPE_STARTER)
-
class Interface:
"""An inteface into a remote object
return object.__call__
else:
return self._obj.__getattr__(member, dbus_interface=_dbus_interface)
-
+
+ def __repr__(self):
+ return '<Interface %r implementing %r at %x>'%(
+ self._obj, self._dbus_interface, id(self))
+ __str__ = __repr__
-class MissingErrorHandlerException(Exception):
- def __init__(self):
- Exception.__init__(self)
-
-
- def __str__(self):
- return "error_handler not defined: if you define a reply_handler you must also define an error_handler"
+import dbus_bindings
+DBusException = dbus_bindings.DBusException
+ConnectionError = dbus_bindings.ConnectionError
-class MissingReplyHandlerException(Exception):
+class MissingErrorHandlerException(DBusException):
def __init__(self):
- Exception.__init__(self)
+ DBusException.__init__(self, "error_handler not defined: if you define a reply_handler you must also define an error_handler")
- def __str__(self):
- return "reply_handler not defined: if you define an error_handler you must also define a reply_handler"
+class MissingReplyHandlerException(DBusException):
+ def __init__(self):
+ DBusException.__init__(self, "reply_handler not defined: if you define an error_handler you must also define a reply_handler")
-class ValidationException(Exception):
+class ValidationException(DBusException):
def __init__(self, msg=''):
- self.msg = msg
- Exception.__init__(self)
-
- def __str__(self):
- return "Error validating string: %s" % self.msg
+ DBusException.__init__(self, "Error validating string: %s"%msg)
-class UnknownMethodException(Exception):
+class UnknownMethodException(DBusException):
def __init__(self, msg=''):
- self.msg = msg
- Exception.__init__(self)
-
- def __str__(self):
- return "Unknown method: %s" % self.msg
+ DBusException.__init__("Unknown method: %s"%msg)
self._named_service,
self._object_path, iface, member)
+ def __repr__(self):
+ return '<ProxyObject wrapping %s %s %s at %x>'%(
+ self._bus, self._named_service, self._object_path , id(self))
+ __str__ = __repr__
+
class ProxyMethod:
"""A proxy Method.