On Tue, May 20, 2008 at 2:12 PM, Garland, Ken R <[EMAIL PROTECTED]> wrote:
>
> No problem, hope this helps:
>
> options_for_select: generate HTML "<option>" set. Combine into select 
> function.
>
> options_for_select_from_objects: same but get the labels and values
> from specific attributes in a list of objects. Deprecate.
>
> options_for_select_from_dicts: same but get the labels and values from
> specific keys in a list of dicts. Deprecate.


Thanks for the help. I ended up just creating the following function
in my lib\helpers.py file:

def create_type_options(type_list):
        return ''.join(map(lambda ct: '<option value=\"%d\">%s</option>' %
(ct.id, ct.name,), type_list))

I am using it like this on the form:
 ${h.select('lbxType', h.create_type_options(c.type_list))}


I tried using the options_for_select but I am assuming is using the
__str__ method of my class, because in the drop down I see the
following HTML:
option value="&lt;foobar.model.ComponentType object at
0x01531310&gt;">&lt;foobarr.model.ComponentType object at
0x01531310&gt;</option>
<option value="&lt;foobar.model.ComponentType object at
0x01531270&gt;">&lt;foobar.model.ComponentType object at
0x01531270&gt;</option>

With my method I am seeing the following HTML, which is what I need:
<option value="1">Operating System</option>
<option value="2">Driver</option>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to