Update of /cvsroot/pydispatcher/dispatch
In directory sc8-pr-cvs1:/tmp/cvs-serv15773
Modified Files:
dispatcher.py
Added Files:
errors.py
Log Message:
Factored errors into their own module, made _Any and _Anonymous not get overridden by their singleton instances so that they provide documentation in PyDoc docs, eliminated extraneous import of exceptions.
--- NEW FILE: errors.py ---
"""Error types for dispatcher mechanism
"""
class DispatcherError(Exception):
"""Base class for all Dispatcher errors"""
class DispatcherKeyError(KeyError, DispatcherError):
"""Error raised when unknown (sender,signal) set specified"""
class DispatcherTypeError(TypeError, DispatcherError):
"""Error raised when inappropriate signal-type specified (None)"""
Index: dispatcher.py
===================================================================
RCS file: /cvsroot/pydispatcher/dispatch/dispatcher.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** dispatcher.py 6 Jul 2003 20:30:28 -0000 1.4
--- dispatcher.py 6 Jul 2003 22:52:32 -0000 1.5
***************
*** 8,19 ****
Any -- Singleton used to signal either "Any Sender" or
! "Any Signal". See documentation of the Any object.
Anonymous -- Singleton used to signal "Anonymous Sender"
! See documentation of the Anonymous object.
! DispatcherError -- Base class for Dispatcher errors
! DispatcherKeyError -- Raised on attempts to disconnect
! a connection which doesn't exist
! DispatcherTypeError -- Raised on use of None as a signal
! during connect/disconnect
Internal attributes:
--- 8,14 ----
Any -- Singleton used to signal either "Any Sender" or
! "Any Signal". See documentation of the _Any class.
Anonymous -- Singleton used to signal "Anonymous Sender"
! See documentation of the _Anonymous class.
Internal attributes:
***************
*** 32,37 ****
"""
from __future__ import generators
! import exceptions, types, weakref
! from dispatch import saferef, robustapply
__author__ = "Patrick K. O'Brien <po...@or...>"
--- 27,32 ----
"""
from __future__ import generators
! import types, weakref
! from dispatch import saferef, robustapply, errors
__author__ = "Patrick K. O'Brien <po...@or...>"
***************
*** 39,50 ****
__version__ = "$Revision$"[11:-2]
-
- class DispatcherError(Exception):
- """Base class for all Dispatcher errors"""
- class DispatcherKeyError(KeyError, DispatcherError):
- """Error raised when unknown (sender,signal) set specified"""
- class DispatcherTypeError(TypeError, DispatcherError):
- """Error raised when inappropriate signal-type specified (None)"""
-
try:
True
--- 34,37 ----
***************
*** 58,62 ****
return self.__class__.__name__
! class Any(_Parameter):
"""Singleton used to signal either "Any Sender" or "Any Signal"
--- 45,49 ----
return self.__class__.__name__
! class _Any(_Parameter):
"""Singleton used to signal either "Any Sender" or "Any Signal"
***************
*** 66,72 ****
a particular sender/signal.
"""
! Any = Any()
! class Anonymous(_Parameter):
"""Singleton used to signal "Anonymous Sender"
--- 53,59 ----
a particular sender/signal.
"""
! Any = _Any()
! class _Anonymous(_Parameter):
"""Singleton used to signal "Anonymous Sender"
***************
*** 86,90 ****
being used everywhere.
"""
! Anonymous = Anonymous()
WEAKREF_TYPES = (weakref.ReferenceType, saferef.BoundMethodWeakref)
--- 73,77 ----
being used everywhere.
"""
! Anonymous = _Anonymous()
WEAKREF_TYPES = (weakref.ReferenceType, saferef.BoundMethodWeakref)
***************
*** 148,152 ****
"""
if signal is None:
! raise DispatcherTypeError(
'Signal cannot be None (receiver=%r sender=%r)'%( receiver,sender)
)
--- 135,139 ----
"""
if signal is None:
! raise errors.DispatcherTypeError(
'Signal cannot be None (receiver=%r sender=%r)'%( receiver,sender)
)
***************
*** 208,212 ****
"""
if signal is None:
! raise DispatcherTypeError(
'Signal cannot be None (receiver=%r sender=%r)'%( receiver,sender)
)
--- 195,199 ----
"""
if signal is None:
! raise errors.DispatcherTypeError(
'Signal cannot be None (receiver=%r sender=%r)'%( receiver,sender)
)
|