[Zope] ZClasses question

Doug McNaught doug@mcnaught.org
07 Sep 1999 23:21:35 -0400


OK, I've read the ZClasses tutorial, and done some playing around.  I
have a test class i'm trying to create, but I'm not sure if what I'm
trying to do is possible.  

The idea is to have a "Random Image" object.  It acts like a Folder in 
that you can drop images into it, but when rendered it picks a random
object from its contents and returns the HTML for it.  

So if I have an RI called "foo", I can put images into it via
cut/paste, upload, etc (just like a folder) but if I refer to
<dtml-var foo> in a document or method, I get the HREF for a random
image in the RI.

I can do this with a regular folder by creating an index_html (which
could just as well be called 'pluck_random_item') in the image folder
containing 

<dtml-var expr="_.whrandom.choice(objectValues())">

and then using the following in my documents:

<dtml-with imagefolder>
  <dtml-var index_html>
</dtml-with>

but I would really like to have the cool object behavior described
above.  I've been thrashing about trying different base classes and
suchlike but haven't found anything that works.  I though that
creating an 'index_html' (which is basically a 'render' method) in a
folder would have that method called automatically upon 
<dtml-var foldername> but it looks like that's not the case. 

Is what I want possible?  If so, what kind of ZClass do I need to
make?

-Doug
-- 
Doug McNaught       doug@mcnaught.org     http://www.mcnaught.org/~doug