[Zope-Checkins] SVN: Zope/trunk/ Merged 2.10 branch r70085:70086
and r70356:70357 into the trunk.
Stefan H. Holek
stefan at epy.co.at
Fri Dec 15 02:42:42 EST 2006
Log message for revision 71555:
Merged 2.10 branch r70085:70086 and r70356:70357 into the trunk.
Collector #2187: PUT_factory broken.
Changed:
U Zope/trunk/doc/CHANGES.txt
U Zope/trunk/lib/python/ZPublisher/BaseRequest.py
A Zope/trunk/lib/python/webdav/tests/testPUT_factory.py
-=-
Modified: Zope/trunk/doc/CHANGES.txt
===================================================================
--- Zope/trunk/doc/CHANGES.txt 2006-12-14 21:52:49 UTC (rev 71554)
+++ Zope/trunk/doc/CHANGES.txt 2006-12-15 07:42:41 UTC (rev 71555)
@@ -109,6 +109,8 @@
- The defaultView directive now only looks up views, not attributes.
+ - Collector #2187: PUT_factory broken (fwd port from 2.10 branch).
+
Other Changes
- Disabled docutils file inclusion completely, rather than trying
Modified: Zope/trunk/lib/python/ZPublisher/BaseRequest.py
===================================================================
--- Zope/trunk/lib/python/ZPublisher/BaseRequest.py 2006-12-14 21:52:49 UTC (rev 71554)
+++ Zope/trunk/lib/python/ZPublisher/BaseRequest.py 2006-12-15 07:42:41 UTC (rev 71555)
@@ -72,37 +72,41 @@
if name[:1]=='_':
raise Forbidden("Object name begins with an underscore at: %s" % URL)
- try:
- if hasattr(object,'__bobo_traverse__'):
+
+ if hasattr(object,'__bobo_traverse__'):
+ try:
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:]
+ # XXX There are no tests for this:
+ request['PARENTS'][-1:] = list(subobject[:-1])
+ object, subobject = subobject[-2:]
+ except (AttributeError, KeyError, NotFound), e:
+ # Try to find a view
+ 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)
+ # No view found. Reraise the error raised by __bobo_traverse__
+ raise e
+ else:
+ # No __bobo_traverse__
+ # Try with an unacquired attribute:
+ if hasattr(aq_base(object), name):
+ subobject = getattr(object, name)
else:
- # Try getting unacquired attributes:
- if hasattr(aq_base(object), name):
- subobject = getattr(object, name)
- else:
- subobject=object[name]
-
- except (AttributeError, KeyError, NotFound), e:
- # Nothing was found with __bobo_traverse__ or directly on
- # the object. We try to fall back to a view:
- 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)
+ # We try to fall back to a view:
+ subobject = queryMultiAdapter((object, request), Interface, name)
+ if subobject is not None:
+ return subobject.__of__(object)
- # And lastly, of there is no view, try acquired attributes, but
- # only if there is no __bobo_traverse__:
- if not hasattr(object,'__bobo_traverse__'):
+ # And lastly, of there is no view, try acquired attributes, but
+ # only if there is no __bobo_traverse__:
try:
subobject=getattr(object, name)
# Again, clear any error status created by __bobo_traverse__
@@ -111,8 +115,11 @@
return subobject
except AttributeError:
pass
- raise e
+ # Lastly we try with key access:
+ subobject = object[name]
+
+
# Ensure that the object has a docstring, or that the parent
# object has a pseudo-docstring for the object. Objects that
# have an empty or missing docstring are not published.
Copied: Zope/trunk/lib/python/webdav/tests/testPUT_factory.py (from rev 70086, Zope/branches/2.10/lib/python/webdav/tests/testPUT_factory.py)
More information about the Zope-Checkins
mailing list