[Zope] - fsimport recursion error or my error?

Brian Lloyd Brian@digicool.com
Mon, 18 Jan 1999 10:46:46 -0500


> > I asked fsimport (mostly unmodified -- I added a couple 
> MIME TYPES) to bring in
> > a directory of images and vrml files and just display the tree
> >
> > <!--#tree branches=objectValues-->
> >   <IMG SRC="<!--#var SCRIPT_NAME-->/<!--#var icon-->">
> >   <!--#var id-->
> > <!--#/tree-->
...
> >
> > fsimport reads the file structure. The strange thing is 
> that is shows each file
> > with the file/image icon, but gives a + like its a 
> directory.  When you click on
> > the file, it gives the ENTIRE tree again as a subdirectory. 
>  Are we using #tree
> > incorrectly?

I think I know what's happenning here. You are not really
using #tree incorrectly - you are just being bitten by the
interaction of acquisition with the tree tag.

Files and Images inherit Acquisition.Implicit. This means that
when the tree tag asks an Image or File for its objectValues
method, it will get the objectValues method acquired from the
parent object of the Image or File (ad infinitum).

You don't see this problem with Documents because Documents
inherit Acquisition.Explicit, so it doesnt automatically 
acquire the objectValues method.

The solution is for non-collection items like Images and Files
to provide their own objectValues which returns an empty sequence,
preventing the recursion. I've added a fix for the next Zope release
so that non-collection objects will do the right thing.




Brian Lloyd        brian@digicool.com
Software Engineer  540.371.6909              
Digital Creations  http://www.digicool.com