"Ian Wilson" <[EMAIL PROTECTED]> writes:
> Do I really have to pass all the widgets as explict members of the return
> dict?
Hmmm... No, you don't.
In [1]:from turbogears import widgets
In [2]:a = [widgets.TextField(name='widget_a'),
widgets.CheckBox(name='widget_b')]
In [3]:a
Out[3]:
[TextField(name='widget_a', convert=True, field_class='textfield', attrs={},
css_classes=[]),
CheckBox(name='widget_b', convert=True, field_class='checkbox', attrs={},
css_classes=[])]
In [4]:a[0].render()
Out[4]:'<INPUT ID="widget_a" TYPE="text" CLASS="textfield" NAME="widget_a">'
In [5]:a[1].render()
Out[5]:'<INPUT CLASS="checkbox" TYPE="checkbox" ID="widget_b" NAME="widget_b">'
As you can see, they can be wrapped on a list. Lets try a dict:
In [6]:d = dict(widget_a = a[0], widget_b=a[1])
In [7]:d['widget_a'].render()
Out[7]:'<INPUT ID="widget_a" TYPE="text" CLASS="textfield" NAME="widget_a">'
In [8]:d['widget_b'].render()
Out[8]:'<INPUT CLASS="checkbox" TYPE="checkbox" ID="widget_b" NAME="widget_b">'
So they can also be in a dictionary.
Does it help?
--
Jorge Godoy <[EMAIL PROTECTED]>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"TurboGears" 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/turbogears
-~----------~----~----~----~------~----~------~--~---