[Zope-Checkins] CVS: Zope/lib/python/ZPublisher - BeforeTraverse.py:1.10.6.1
Brian Lloyd
brian@zope.com
Tue, 17 Jun 2003 13:45:48 -0400
Update of /cvs-repository/Zope/lib/python/ZPublisher
In directory cvs.zope.org:/tmp/cvs-serv5752
Modified Files:
Tag: Zope-2_6-branch
BeforeTraverse.py
Log Message:
fix for 641
=== Zope/lib/python/ZPublisher/BeforeTraverse.py 1.10 => 1.10.6.1 ===
--- Zope/lib/python/ZPublisher/BeforeTraverse.py:1.10 Wed Aug 14 18:09:40 2002
+++ Zope/lib/python/ZPublisher/BeforeTraverse.py Tue Jun 17 13:45:48 2003
@@ -14,6 +14,7 @@
"""BeforeTraverse interface and helper classes"""
+from Acquisition import aq_base
from zLOG import LOG, ERROR
import sys
@@ -129,7 +130,16 @@
except AttributeError:
return
- args = getattr(getattr(meth, 'func_code', None), 'co_argcount', 2)
+ # The code below can acquire "func_code" from an unrelated object
+ # on the acquisition chain.
+ # This happens especially, if "meth" is a "CookieCrumber" instance,
+ # i.e. in a CMF Portal, if a DTMLMethod (or a similar object
+ # with a fake "func_code" is in the acquisition context
+ #args = getattr(getattr(meth, 'func_code', None), 'co_argcount', 2)
+ args = getattr(getattr(aq_base(meth), 'func_code', None),
+ 'co_argcount',
+ 2)
+
try:
apply(meth, (container, request, None)[:args])
except (ArithmeticError, AttributeError, FloatingPointError,