[z3-five] Re: Traversal issue [was: 0.2 release]
Sidnei da Silva
sidnei at awkly.org
Mon Oct 4 16:45:45 MEST 2004
| Ok, going to make a patch and put in the collector then.
Before posting to the collector, could someone proof-read it? It makes
the tests pass on my branch. Will also add tests to Zope itself if it
looks good.
--
Sidnei da Silva <sidnei at awkly.org>
http://awkly.org - dreamcatching :: making your dreams come true
http://www.enfoldsystems.com
http://plone.org/about/team#dreamcatcher
Time-sharing is the junk-mail part of the computer business.
-- H.R.J. Grosch (attributed)
-------------- next part --------------
Index: lib/python/ZPublisher/BaseRequest.py
===================================================================
RCS file: /cvs-repository/Packages/ZPublisher/Attic/BaseRequest.py,v
retrieving revision 1.51.2.2
diff -u -r1.51.2.2 BaseRequest.py
--- lib/python/ZPublisher/BaseRequest.py 17 Nov 2003 22:34:19 -0000 1.51.2.2
+++ lib/python/ZPublisher/BaseRequest.py 4 Oct 2004 14:47:19 -0000
@@ -298,15 +298,15 @@
"Object name begins with an underscore at: %s" % URL)
else: return response.forbiddenError(entry_name)
- if hasattr(object,'__bobo_traverse__'):
- subobject=object.__bobo_traverse__(request,entry_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:
+ try:
+ if hasattr(object,'__bobo_traverse__'):
+ subobject=object.__bobo_traverse__(request,entry_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:
# Note - no_acquire_flag is necessary to support
# things like DAV. We have to make sure
# that the target object is not acquired
@@ -323,16 +323,16 @@
subobject=getattr(object, entry_name)
else: raise AttributeError, entry_name
else: subobject=getattr(object, entry_name)
- except AttributeError:
- got=1
- try: subobject=object[entry_name]
- except (KeyError, IndexError,
- TypeError, AttributeError):
- if debug_mode:
- return response.debugError(
- "Cannot locate object at: %s" % URL)
- else:
- return response.notFoundError(URL)
+ except AttributeError:
+ got=1
+ try: subobject=object[entry_name]
+ except (KeyError, IndexError,
+ TypeError, AttributeError):
+ if debug_mode:
+ return response.debugError(
+ "Cannot locate object at: %s" % URL)
+ else:
+ return response.notFoundError(URL)
# Ensure that the object has a docstring, or that the parent
# object has a pseudo-docstring for the object. Objects that
@@ -352,7 +352,7 @@
# certain mutable types (dicts, lists) to become publishable
# when they shouldn't be. The following check makes sure that
# the right thing happens in both 2.2.2+ and earlier versions.
-
+
if not typeCheck(subobject):
return response.debugError(
"The object at %s is not publishable." % URL
More information about the z3-five
mailing list