[Zope-Checkins]
SVN: Zope/branches/easter-sprint_traversal-refactor/lib/python/
Last test failure fixes!
Lennart Regebro
regebro at gmail.com
Fri Apr 28 05:55:13 EDT 2006
Log message for revision 67701:
Last test failure fixes!
Changed:
U Zope/branches/easter-sprint_traversal-refactor/lib/python/OFS/Traversable.py
U Zope/branches/easter-sprint_traversal-refactor/lib/python/ZPublisher/BaseRequest.py
-=-
Modified: Zope/branches/easter-sprint_traversal-refactor/lib/python/OFS/Traversable.py
===================================================================
--- Zope/branches/easter-sprint_traversal-refactor/lib/python/OFS/Traversable.py 2006-04-28 09:42:45 UTC (rev 67700)
+++ Zope/branches/easter-sprint_traversal-refactor/lib/python/OFS/Traversable.py 2006-04-28 09:55:12 UTC (rev 67701)
@@ -242,10 +242,11 @@
except (NotFound, KeyError):
# Try to look for a view
next = queryMultiAdapter((obj, self.REQUEST),
- Interface, name).__of__(obj)
+ Interface, name)
if next is None:
# Didn't find one, reraise the error:
raise
+ next = next.__of__(obj)
if restricted and not securityManager.validate(
obj, obj, _none, next):
raise Unauthorized, name
Modified: Zope/branches/easter-sprint_traversal-refactor/lib/python/ZPublisher/BaseRequest.py
===================================================================
--- Zope/branches/easter-sprint_traversal-refactor/lib/python/ZPublisher/BaseRequest.py 2006-04-28 09:42:45 UTC (rev 67700)
+++ Zope/branches/easter-sprint_traversal-refactor/lib/python/ZPublisher/BaseRequest.py 2006-04-28 09:55:12 UTC (rev 67701)
@@ -72,33 +72,33 @@
if name[:1]=='_':
raise Forbidden("Object name begins with an underscore at: %s" % URL)
- if hasattr(object,'__bobo_traverse__'):
- subobject=object.__bobo_traverse__(request, name)
- if type(subobject) is type(()) and len(subobject) > 1:
- # Add additional parents into the path
- parents[-1:] = list(subobject[:-1])
- object, subobject = subobject[-2:]
- else:
- try:
- subobject=getattr(object, name)
- except AttributeError:
+ try:
+ if hasattr(object,'__bobo_traverse__'):
+ subobject=object.__bobo_traverse__(request, name)
+ if type(subobject) is type(()) and len(subobject) > 1:
+ # Add additional parents into the path
+ # XXX This needs handling. Check the publish refactor branch...
+ parents[-1:] = list(subobject[:-1])
+ object, subobject = subobject[-2:]
+ else:
try:
+ subobject=getattr(object, name)
+ except AttributeError:
subobject=object[name]
- except (AttributeError, KeyError, NotFound):
- # Find a view even if it doesn't start with @@, but only
- # If nothing else could be found
- ob2 = queryMultiAdapter((object, request), Interface, name)
- if ob2 is not None:
- # OFS.Application.__bobo_traverse__ calls
- # REQUEST.RESPONSE.notFoundError which sets the HTTP
- # status code to 404
- request.RESPONSE.setStatus(200)
- # We don't need to do the docstring security check
- # for views, so lets skip it and return the object here.
- return ob2.__of__(object)
- else:
- # There was no view, reraise the earlier error:
- raise
+
+ except (AttributeError, KeyError, NotFound):
+ # Find a view even if it doesn't start with @@, but only
+ # If nothing else could be found
+ subobject = queryMultiAdapter((object, request), Interface, name)
+ if subobject is not None:
+ # OFS.Application.__bobo_traverse__ calls
+ # REQUEST.RESPONSE.notFoundError which sets the HTTP
+ # status code to 404
+ request.RESPONSE.setStatus(200)
+ # We don't need to do the docstring security check
+ # for views, so lets skip it and return the object here.
+ return subobject.__of__(object)
+ raise
# Ensure that the object has a docstring, or that the parent
# object has a pseudo-docstring for the object. Objects that
More information about the Zope-Checkins
mailing list