[Zope] How to type check OR better list selector ways
Jim Washington
jwashin@vt.edu
Fri, 20 Oct 2000 16:05:56 -0400
Hi, Robert
BTW, this is a FAQ, but:
use the :list extension in your html.
e.g.,
<select multiple name="<dtml-var form_save_name>:list">
<dtml-in thelistitems>
<option value="<dtml-var sequence-item>"><dtml-var
sequence-item></option>
</dtml-in>
</select>
Works for checkboxes, too!
-- Jim Washington
Robert Joseph Roos wrote:
>
> <dtml-expr="_.type(some_variable_of_unknown_type)">
>
> causes a name error, while other python builtins
> like _.string(some_int) work fine. What gives?
> Is there some other "zopist" way to type-check?
>
> More generally, is there a better way to deal with the annoying
> fact that multiple selectors return a list UNLESS there are
> <=1 items selected, in which case they return a single item or None?
>
> (rather than a list with only one member, in the case of 1 object
> selected, or an empty list, in the case of none,
> which would SEEM to be the consistant way to do things,
> since <dtml-in> wouldn't choke.)