home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2010 May / Mac Life Ubuntu.iso / casper / filesystem.squashfs / var / lib / python-support / python2.6 / dbus / exceptions.pyc (.txt) < prev    next >
Encoding:
Python Compiled Bytecode  |  2009-04-20  |  4.4 KB  |  86 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyc (Python 2.6)
  3.  
  4. '''D-Bus exceptions.'''
  5. __all__ = ('DBusException', 'MissingErrorHandlerException', 'MissingReplyHandlerException', 'ValidationException', 'IntrospectionParserException', 'UnknownMethodException', 'NameExistsException')
  6.  
  7. class DBusException(Exception):
  8.     include_traceback = False
  9.     
  10.     def __init__(self, *args, **kwargs):
  11.         name = kwargs.pop('name', None)
  12.         if name is not None or getattr(self, '_dbus_error_name', None) is None:
  13.             self._dbus_error_name = name
  14.         
  15.         if kwargs:
  16.             raise TypeError('DBusException does not take keyword arguments: %s' % ', '.join(kwargs.keys()))
  17.         kwargs
  18.         Exception.__init__(self, *args)
  19.  
  20.     
  21.     def __str__(self):
  22.         s = Exception.__str__(self)
  23.         if self._dbus_error_name is not None:
  24.             return '%s: %s' % (self._dbus_error_name, s)
  25.         return s
  26.  
  27.     
  28.     def get_dbus_message(self):
  29.         s = Exception.__str__(self)
  30.         return s.decode('utf-8', 'replace')
  31.  
  32.     
  33.     def get_dbus_name(self):
  34.         return self._dbus_error_name
  35.  
  36.  
  37.  
  38. class MissingErrorHandlerException(DBusException):
  39.     include_traceback = True
  40.     
  41.     def __init__(self):
  42.         DBusException.__init__(self, 'error_handler not defined: if you define a reply_handler you must also define an error_handler')
  43.  
  44.  
  45.  
  46. class MissingReplyHandlerException(DBusException):
  47.     include_traceback = True
  48.     
  49.     def __init__(self):
  50.         DBusException.__init__(self, 'reply_handler not defined: if you define an error_handler you must also define a reply_handler')
  51.  
  52.  
  53.  
  54. class ValidationException(DBusException):
  55.     include_traceback = True
  56.     
  57.     def __init__(self, msg = ''):
  58.         DBusException.__init__(self, 'Error validating string: %s' % msg)
  59.  
  60.  
  61.  
  62. class IntrospectionParserException(DBusException):
  63.     include_traceback = True
  64.     
  65.     def __init__(self, msg = ''):
  66.         DBusException.__init__(self, 'Error parsing introspect data: %s' % msg)
  67.  
  68.  
  69.  
  70. class UnknownMethodException(DBusException):
  71.     include_traceback = True
  72.     _dbus_error_name = 'org.freedesktop.DBus.Error.UnknownMethod'
  73.     
  74.     def __init__(self, method):
  75.         DBusException.__init__(self, 'Unknown method: %s' % method)
  76.  
  77.  
  78.  
  79. class NameExistsException(DBusException):
  80.     include_traceback = True
  81.     
  82.     def __init__(self, name):
  83.         DBusException.__init__(self, 'Bus name already exists: %s' % name)
  84.  
  85.  
  86.