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

Trevor Toenjes zope@toenjes.com
Sun, 9 Sep 2001 10:54:22 -0400


Maybe someone can check my logic...? please.
<dtml-with folderwithmyZclasses>
<dtml-var
expr="_.random.choice(objectValues('myZclass').myZclassDTMLmethod)">
</dtml-with>

RETURNS:: Error Type: AttributeError
Error Value: myZclassDTMLmethod
And this doesnt work...<dtml-var
expr="_.random.choice(objectValues(['myZclass']).objectValues(['myZclassDTML
method']))">

So far...this is working.  This displays "myZclassDTMLmethod" for every
'myZclass' in the "folderwithmyZclasses" folder.
<dtml-with folderwithZclasses>
<dtml-in "objectValues(['myZclass'])">
    <li><dtml-var myZclassDTMLmethod>
</dtml-in>
</dtml-with>

TIA,
-Trevor




> Q:  I want to generate the DTMLMethod "foo" from a randomly
> selected zClass
> in the Folder "bar".
>
> As a newbie to developing and to Zope, I have hit a wall with this one...
> So far, I have randomly generated images, and randomly generated ID's for
> cookies...but the same approach does not seem to be working on zclass
> methods.
>
> If this helps, I can generate a DTMLmethod using...
> <dtml-with bar>
>   <dtml-with azClassID>
>     <dtml-var foo>
>   </dtml-with>
> </dtml-with>
>
> i stopped here...
> <dtml-var expr="_.random.choice(bar.objectValues('id').foo)">
>
> Would it work better if "foo" was a DTMLDocument?
> I cant find any reference to something like this, so maybe this
> will become
> my first how-to.
> Thanks for the help,
> -Trevor
>
>
>
>
>
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists -
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope-dev )