[Zope-CMF] ZPT Tree breaks with CMF Site :-S

Chris Withers chrisw@nipltd.com
Tue, 10 Sep 2002 18:51:08 +0100


Hi all,

I have a problem with a script that uses SimpleTreeMaker in a CMF site:

"""
from ZTUtils import SimpleTreeMaker

tm = SimpleTreeMaker()
def children(obj):
     return obj.contentValues(filter={
         'portal_type':[***some content types***]})

tm.setChildAccess(function=children)

tree = tm.tree(context,expanded=1)

return tree.flat()
"""

Now, this used to work in CMF1.2+, but now doesn't in latest CVS CMF if you 
execute it on the CMF object itself :-(
If you use it on any subobjects of the CMF, it works fine, but on the CMF object 
itself, you get:

   File Script (Python), line 9, in navigator_helper
   File D:\Zope\2.5.1\lib\python\ZTUtils\Tree.py, line 135, in tree
   File D:\Zope\2.5.1\lib\python\ZTUtils\SimpleTree.py, line 60, in markRoot
TALESError: exceptions.AttributeError on REQUEST

The line in SimpleTree is acquiring REQUEST from the object, so I had a play 
with the acquisition understander (http://www.zope.org/Members/chrisw/showaq)

In the situation where the script works, you get the following for showaq(root):

aSkinnedFolder
|
CMFSite
|
Zope
|
<RequestContainer instance at 015EBD58>

and showaq(node.object) gives:

(aSkinnedFolder)
|  \
|   aSkinnedFolder
|   |
|   CMFSite
|   |
|   Zope
|   |
|   <RequestContainer instance at 015EBD58>
|
aSkinnedFolder
|
AAAAAAAAO8Y_

In the situation where the script doesn't work, I get the following for 
showaq(root):

CMFSite
|
Zope
|
<RequestContainer instance at 0165E6E8>

...and the following for showaq(node.object):

CMFSite
|
AAAAAAAAN4I_

Can anyone shed any light on this, and when the behaviour of the PortalObject 
class changed?

cheers,

Chris