[Zope-Checkins] CVS: Zope/lib/python/ZPublisher - BaseRequest.py:1.46.28.2
Casey Duncan
casey@zope.com
Wed, 27 Mar 2002 15:25:53 -0500
Update of /cvs-repository/Zope/lib/python/ZPublisher
In directory cvs.zope.org:/tmp/cvs-serv13008/ZPublisher
Modified Files:
Tag: casey-death_to_index_html-branch
BaseRequest.py
Log Message:
Refactored death to index_html implementation to handle the root app object,
and for better bw compatibility with products subclassing
ObjectManager/Folder and legacy Folder instances. Previous implementation was
a bit overzealous by default.
=== Zope/lib/python/ZPublisher/BaseRequest.py 1.46.28.1 => 1.46.28.2 ===
if path:
entry_name = path.pop()
+ elif hasattr(getattr(object, 'aq_base', object),
+ 'browser_default'):
+ # If we have reached the end of the path. We look to see
+ # if the object implements browser_default. If so, we
+ # call it to let the object tell us how to publish it
+ # browser_default returns the object to be published
+ # (usually self) and a sequence of names to traverse to
+ # find the method to be published. (Casey)
+ request._hacked_path=1
+ object, default_path = object.browser_default(request)
+ if len(default_path) > 1:
+ path = list(default_path)
+ method = path.pop()
+ request['TraversalRequestNameStack'] = path
+ continue
+ else:
+ method = default_path[0]
+ entry_name = method
elif (method and hasattr(object,method)
and entry_name != method
and getattr(object, method) is not None):
@@ -338,22 +356,6 @@
parents.append(object)
steps.append(entry_name)
-
- # If we have reached the end of the path. We look to see
- # if the object implements browser_default. If so, we
- # call it to let the object tell us how to publish it
- # browser_default returns the object to be published
- # (usually self) and a sequence of names to traverse to
- # find the method to be published. (Casey)
- if not path and hasattr(getattr(object, 'aq_base', object),
- 'browser_default'):
- object, default_path = object.browser_default(request)
- if len(default_path) > 1:
- path = list(default_path)
- method = path.pop()
- request['TraversalRequestNameStack'] = path
- else:
- method = default_path[0]
finally:
parents.reverse()