Kevin Dangoor <[EMAIL PROTECTED]> writes:

> I've unhijacked the thread by changing the subject.

Thanks!  I didn't change it because I didn't found the "correct" name for
it.

>
>>
>>  comment_form = TableForm(fields=[CommentFields(), special_consideration =
>>  TextArea()])
>>
>> I mean, is it possible to combine the declaration with something else (or two
>> declarations, or ...)?
>
> Here's a bit of groovyness: WidgetDeclarations are, in fact, lists.
>
> In [1]:from turbogears.widgets import *
>
> In [2]:class MyWidgets(Wid
> Widget              WidgetDescription   WidgetsDeclaration
>
> In [2]:class MyWidgets(WidgetsDeclaration):
>    ...:    name = TextField()
>    ...:    address = TextArea()
>    ...:
>    ...:
>
> In [3]:w = MyWidgets()
>
> In [4]:print w
> [<turbogears.widgets.forms.TextField object at 0x4b1230>,
> <turbogears.widgets.forms.TextArea object at 0x1184cb0>]
>
> In [6]:print w+[TextArea()]
> [<turbogears.widgets.forms.TextField object at 0x4b1230>,
> <turbogears.widgets.forms.TextArea object at 0x1184cb0>,
> <turbogears.widgets.forms.TextArea object at 0x1184c90>]
>
> So your example:
>
> comment_form = TableForm(fields=[CommentFields(), special_consideration =
>  TextArea()])
>
> just becomes:
>
> comment_form = TableForm(fields=CommentFields() + [
>  TextArea("special_consideration")])

It's easier than I thought. :-)


Thanks.

-- 
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to