[Zope] how-to generate a DTMLMethod from a random zClass in a Folder???

Trevor Toenjes zope@toenjes.com
Mon, 10 Sep 2001 18:32:22 -0400


That was it!!!!  thanks Dieter...I can wipe the blood from my dense...uh,
dents in my head.   ;)

To wrap up my lesson for the thread.   The answer is...

<dtml-with
expr="_.random.choice(folderwithmyZclasses.objectValues('myZclass'))">
    <dtml-var myZclassmethod>
</dtml-with>


-Trevor

Continuing thoughts:
Should I assume there is no "one-liner" to do this?  [Chris?]
--1)A variable would have to be set in the middle of the argument while
generating the random zClass and
--2) get referenced again at the end as an attribute of the DTMLMethod.
It might also produce code that is hard to read.
sample attempt:  (shows I still dont quite grasp how to use REQUEST beyond
basics)
<dtml-var
expr="_.random.choice(folderwithmyZclasses."REQUEST.set('zi',objectValues('m
yZclass'))".myZclassmethod(zi,_)">

Chris also suggested making a Python script from this...
which could then pass a foldername, zClassname, and DTMLMethod.  Cuz, I will
prolly do this again.
     OR
would this be better in ZPT? ... since it inserts random zClass content?