Re: [Zope] Creating a "list of strings" from DTML-Method?
Soren Roug <soren@roug.org>
Organization: Net.conf To: zope@zope.org Subject: [Zope] Creating a "list of strings" from DTML-Method?
I'm working on a product where I want to create a property that is a selection and allows you to select between a list of folders created in the parent folder.
When you add a property in the property sheet the text directly above says: | |For "selection" and "multiple selection" properties enter the name of |a selection variable |in the "Value" field. The selection variable is |a property or method that returns a list of strings from which the |selection(s) can be chosen. | After fiddling around a bit I realized that the only methods that qualify are Z SQL methods. That's not what I'm looking for. Does anybody know how to do this with a DTML method or has anyone subclassed the DTML method to a class that returns a list of strings instead of rendering the text?
Jim Washington <jwashin@vt.edu>
Hi, Soren
You might want put the following in a new dtml method and see if it does what you need:
<dtml-call "REQUEST.set('folderlist', objectIds('Folder'))"> <dtml-return folderlist>
Or you might make the list like so:
<dtml-call "REQUEST.set('folderlist', ['folder1', 'folder2', 'folder3'])"> <dtml-return folderlist>
IIRC, dtml-return is relatively new to zope, so if it does not work, you may need to upgrade.
The temporary isn't needed in this case (might be if you build the list up programmatically):: <dtml-return expr="objectIds( 'Foler' ) )"> or:: <dtml-return expr="[ 'folder1', 'folder2', 'folder3' ]"> work fine. Tres. -- ========================================================= Tres Seaver tseaver@palladion.com 713-523-6582 Palladion Software http://www.palladion.com
participants (1)
-
Tres Seaver