Commit 56d12169 authored by Casey Duncan's avatar Casey Duncan

Fix failure mode in (un)restrictedTraverse so that it raises a NotFound error wh

en traversing from a non-mapping object, rather than an obscure AttributeError o
n __getitem__
parent 548c587a
...@@ -12,8 +12,8 @@ ...@@ -12,8 +12,8 @@
############################################################################## ##############################################################################
'''This module implements a mix-in for traversable objects. '''This module implements a mix-in for traversable objects.
$Id: Traversable.py,v 1.17 2002/09/18 15:48:59 shane Exp $''' $Id: Traversable.py,v 1.18 2003/02/26 16:51:46 caseman Exp $'''
__version__='$Revision: 1.17 $'[11:-2] __version__='$Revision: 1.18 $'[11:-2]
from Acquisition import Acquired, aq_inner, aq_parent, aq_base from Acquisition import Acquired, aq_inner, aq_parent, aq_base
...@@ -140,7 +140,11 @@ class Traversable: ...@@ -140,7 +140,11 @@ class Traversable:
else: else:
o = get(object, name, M) o = get(object, name, M)
if o is M: if o is M:
o=object[name] try:
o=object[name]
except AttributeError:
# Raise a NotFound for easier debugging
raise 'NotFound', name
if (restricted and not securityManager.validate( if (restricted and not securityManager.validate(
object, object, N, o)): object, object, N, o)):
raise Unauthorized, name raise Unauthorized, name
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment