diff options
author | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2007-09-27 18:13:42 +0100 |
---|---|---|
committer | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2007-09-27 18:13:42 +0100 |
commit | 05460fdecf77c56640c332d290a5950884f26769 (patch) | |
tree | 0f07ff7f5b5050480091e40c9a86d9dc83f74796 | |
parent | 79b4ea50399db59fa8459badf33918764677248d (diff) | |
download | dbus-python-05460fdecf77c56640c332d290a5950884f26769.tar.gz |
dbus.exceptions.DBusException: allow setting _dbus_error_name in subclasses
-rw-r--r-- | dbus/exceptions.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/dbus/exceptions.py b/dbus/exceptions.py index 1fca069..6a0fbaf 100644 --- a/dbus/exceptions.py +++ b/dbus/exceptions.py @@ -29,7 +29,9 @@ __all__ = ('DBusException', 'MissingErrorHandlerException', class DBusException(Exception): def __init__(self, *args, **kwargs): - self._dbus_error_name = kwargs.pop('name', None) + name = kwargs.pop('name', None) + if name is not None or getattr(self, '_dbus_error_name', None) is None: + self._dbus_error_name = name if kwargs: raise TypeError('DBusException does not take keyword arguments: %s' % ', '.join(kwargs.keys())) |