[Zope3-checkins] CVS: Zope3/src/zope/publisher/interfaces - __init__.py:1.8
Steve Alexander
steve@cat-box.net
Wed, 19 Feb 2003 10:25:59 -0500
Update of /cvs-repository/Zope3/src/zope/publisher/interfaces
In directory cvs.zope.org:/tmp/cvs-serv25645/src/zope/publisher/interfaces
Modified Files:
__init__.py
Log Message:
Defined INotFound, in order to provide a nice view on 404s.
=== Zope3/src/zope/publisher/interfaces/__init__.py 1.7 => 1.8 ===
--- Zope3/src/zope/publisher/interfaces/__init__.py:1.7 Tue Feb 11 11:00:09 2003
+++ Zope3/src/zope/publisher/interfaces/__init__.py Wed Feb 19 10:25:58 2003
@@ -19,20 +19,32 @@
from zope.interface import Interface
from zope.interface import Attribute
from zope.exceptions import Unauthorized
-from zope.exceptions import NotFoundError
+from zope.exceptions import NotFoundError, INotFoundError
from zope.component.interfaces import IPresentationRequest
from zope.interface.common.mapping import IEnumerableMapping
+from zope.interface.common.interfaces import IException
+class IPublishingException(IException):
+ pass
class PublishingException(Exception):
- pass
+ __implements__ = IPublishingException
+class ITraversalException(IPublishingException):
+ pass
class TraversalException(PublishingException):
- pass
+ __implements__ = ITraversalException
+
+class INotFound(INotFoundError, ITraversalException):
+ def getObject():
+ 'Returns the object that was being traversed.'
+ def getName():
+ 'Returns the name that was being traversed.'
class NotFound(NotFoundError, TraversalException):
+ __implements__ = INotFound
def __init__(self, ob, name, request=None):
self.ob = ob
@@ -45,8 +57,10 @@
return self.name
def __str__(self):
- try: ob = `self.ob`
- except: ob = 'unprintable object'
+ try:
+ ob = `self.ob`
+ except:
+ ob = 'unprintable object'
return 'Object: %s, name: %s' % (ob, `self.name`)