[Zope3-checkins] CVS: Zope3/src/zope/exceptions - __init__.py:1.3 _duplicate.py:1.3 _forbidden.py:1.3 _notfounderror.py:1.3 _zope_error.py:1.3 unauthorized.py:1.3

Steve Alexander steve@cat-box.net
Tue, 4 Feb 2003 15:22:03 -0500


Update of /cvs-repository/Zope3/src/zope/exceptions
In directory cvs.zope.org:/tmp/cvs-serv1888/src/zope/exceptions

Modified Files:
	__init__.py _duplicate.py _forbidden.py _notfounderror.py 
	_zope_error.py unauthorized.py 
Log Message:
added interfaces for exceptions


=== Zope3/src/zope/exceptions/__init__.py 1.2 => 1.3 ===
--- Zope3/src/zope/exceptions/__init__.py:1.2	Wed Dec 25 09:13:38 2002
+++ Zope3/src/zope/exceptions/__init__.py	Tue Feb  4 15:21:59 2003
@@ -19,8 +19,9 @@
 $Id$
 """
 
-from zope.exceptions._zope_error import ZopeError
-from zope.exceptions.unauthorized import Unauthorized
-from zope.exceptions._notfounderror import NotFoundError
+from zope.exceptions._zope_error import ZopeError, IZopeError
+from zope.exceptions.unauthorized import Unauthorized, IUnauthorized
+from zope.exceptions._notfounderror import NotFoundError, INotFoundError
 from zope.exceptions._forbidden import Forbidden, ForbiddenAttribute
-from zope.exceptions._duplicate import DuplicationError
+from zope.exceptions._forbidden import IForbidden, IForbiddenAttribute
+from zope.exceptions._duplicate import DuplicationError, IDuplicationError


=== Zope3/src/zope/exceptions/_duplicate.py 1.2 => 1.3 ===
--- Zope3/src/zope/exceptions/_duplicate.py:1.2	Wed Dec 25 09:13:38 2002
+++ Zope3/src/zope/exceptions/_duplicate.py	Tue Feb  4 15:21:59 2003
@@ -14,7 +14,13 @@
 """
 $Id$
 """
-from zope.exceptions import ZopeError
+from zope.exceptions import ZopeError, IZopeError
+from zope.interface.implements import implements
 
 class DuplicationError(ZopeError):
     """A duplicate registration was attempted"""
+
+class IDuplicationError(IZopeError):
+    pass
+
+implements(DuplicationError, IDuplicationError)


=== Zope3/src/zope/exceptions/_forbidden.py 1.2 => 1.3 ===
--- Zope3/src/zope/exceptions/_forbidden.py:1.2	Wed Dec 25 09:13:38 2002
+++ Zope3/src/zope/exceptions/_forbidden.py	Tue Feb  4 15:21:59 2003
@@ -14,12 +14,22 @@
 """
 $Id$
 """
-from zope.exceptions import ZopeError
+from zope.exceptions import ZopeError, IZopeError
+from zope.interface.implements import implements
+from zope.interface.common.interfaces import IAttributeError
 
 class Forbidden(ZopeError):
     """A resource cannot be accessed under any circumstances
     """
 
+class IForbidden(IZopeError):
+    pass
+
 class ForbiddenAttribute(Forbidden, AttributeError):
     """An attribute is unavailable because it is forbidden (private)
     """
+class IForbiddenAttribute(IForbidden, IAttributeError):
+    pass
+
+implements(Forbidden, IForbidden)
+implements(ForbiddenAttribute, IForbiddenAttribute)


=== Zope3/src/zope/exceptions/_notfounderror.py 1.2 => 1.3 ===
--- Zope3/src/zope/exceptions/_notfounderror.py:1.2	Wed Dec 25 09:13:38 2002
+++ Zope3/src/zope/exceptions/_notfounderror.py	Tue Feb  4 15:21:59 2003
@@ -14,8 +14,14 @@
 """
 $Id$
 """
-from zope.exceptions import ZopeError
+from zope.exceptions import ZopeError, IZopeError
+from zope.interface.common.interfaces import IKeyError
+from zope.interface.implements import implements
 
 class NotFoundError(ZopeError, KeyError):
     """A resource could not be found.
     """
+class INotFoundError(IZopeError, IKeyError):
+    pass
+
+implements(NotFoundError, INotFoundError)


=== Zope3/src/zope/exceptions/_zope_error.py 1.2 => 1.3 ===
--- Zope3/src/zope/exceptions/_zope_error.py:1.2	Wed Dec 25 09:13:38 2002
+++ Zope3/src/zope/exceptions/_zope_error.py	Tue Feb  4 15:21:59 2003
@@ -15,6 +15,13 @@
 
 $Id$
 """
+from zope.interface.common.interfaces import IException
+from zope.interface.implements import implements
 
-class ZopeError( Exception ):
+class ZopeError(Exception):
     """ Generic base class for Zope errors."""
+
+class IZopeError(IException):
+    pass
+
+implements(ZopeError, IZopeError)


=== Zope3/src/zope/exceptions/unauthorized.py 1.2 => 1.3 ===
--- Zope3/src/zope/exceptions/unauthorized.py:1.2	Wed Dec 25 09:13:38 2002
+++ Zope3/src/zope/exceptions/unauthorized.py	Tue Feb  4 15:21:59 2003
@@ -17,6 +17,8 @@
 
 from types import StringType
 from zope.exceptions import ZopeError
+from zope.exceptions import IZopeError
+from zope.interface.implements import implements
 
 class Unauthorized(ZopeError):
     """Some user wasn't allowed to access a resource"""
@@ -68,3 +70,8 @@
         c = getattr(v, '__class__', type(v))
         c = getattr(c, '__name__', 'object')
         return "a particular %s" % c
+
+class IUnauthorized(IZopeError):
+    pass
+
+implements(Unauthorized, IUnauthorized)