[Zope-Checkins] CVS: Packages/ZPublisher - BaseRequest.py:1.51.2.3
Sidnei da Silva
sidnei at awkly.org
Wed Nov 3 12:47:04 EST 2004
Update of /cvs-repository/Packages/ZPublisher
In directory cvs.zope.org:/tmp/cvs-serv9379/lib/python/ZPublisher
Modified Files:
Tag: Zope-2_7-branch
BaseRequest.py
Log Message:
- Catch AttributeErrors and KeyErrors raised from
__bobo_traverse__ and convert them to NotFound. In debug mode
a more verbose error message is issued, the same way it's done
on attribute/item traversal.
=== Packages/ZPublisher/BaseRequest.py 1.51.2.2 => 1.51.2.3 ===
--- Packages/ZPublisher/BaseRequest.py:1.51.2.2 Mon Nov 17 17:34:19 2003
+++ Packages/ZPublisher/BaseRequest.py Wed Nov 3 12:46:34 2004
@@ -299,14 +299,20 @@
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:]
+ try:
+ 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:]
+ except (AttributeError, KeyError):
+ if debug_mode:
+ return response.debugError(
+ "Cannot locate object at: %s" % URL)
+ else:
+ return response.notFoundError(URL)
else:
try:
-
# Note - no_acquire_flag is necessary to support
# things like DAV. We have to make sure
# that the target object is not acquired
@@ -352,7 +358,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 Zope-Checkins
mailing list