[Zope-Checkins] CVS: Zope/lib/python/OFS - Traversable.py:1.19
Fred L. Drake, Jr.
fred@zope.com
Thu, 17 Apr 2003 13:46:58 -0400
Update of /cvs-repository/Zope/lib/python/OFS
In directory cvs.zope.org:/tmp/cvs-serv27014
Modified Files:
Traversable.py
Log Message:
- give nearly-anonymous exception a local name
- modernize a type-check
=== Zope/lib/python/OFS/Traversable.py 1.18 => 1.19 ===
--- Zope/lib/python/OFS/Traversable.py:1.18 Wed Feb 26 11:51:46 2003
+++ Zope/lib/python/OFS/Traversable.py Thu Apr 17 13:46:57 2003
@@ -22,8 +22,9 @@
from AccessControl.ZopeGuards import guarded_getattr
from urllib import quote
+NotFound = 'NotFound'
+
_marker=[]
-StringType=type('')
class Traversable:
@@ -75,7 +76,7 @@
N=None
M=_marker
- if type(path) is StringType: path = path.split('/')
+ if isinstance(path, str): path = path.split('/')
else: path=list(path)
REQUEST={'TraversalRequestNameStack': path}
@@ -104,7 +105,7 @@
if name[0] == '_':
# Never allowed in a URL.
- raise 'NotFound', name
+ raise NotFound, name
if name=='..':
o=getattr(object, 'aq_parent', M)
@@ -143,8 +144,8 @@
try:
o=object[name]
except AttributeError:
- # Raise a NotFound for easier debugging
- raise 'NotFound', name
+ # Raise NotFound for easier debugging
+ raise NotFound, name
if (restricted and not securityManager.validate(
object, object, N, o)):
raise Unauthorized, name