On Nov 14, 2006, at 4:09 AM, chiangf wrote:
>
> Oh, actually, I agree with what you said about the disorganization,
> :)... I wish there were more examples of widgets too
>
> Speaking of which, more examples might solve my current problem... say
> I have two widget classes:
> class UserField(widgets.WidgetsList):
> username = widgets.TextField(validator=validators.NotEmpty())
> email = widgets.TextField(attrs={'size':30},
> validator=validators.NotEmpty())
>
> class PasswordField(widgets.WidgetsList):
> password = widgets.PasswordField('password',
> validator=validators.NotEmpty())
> passwordConfirm = widgets.PasswordField('passwordConfirm',
> validator=validators.NotEmpty())
>
>
> And I want to concatenate them together, e.g.:
> def userAddForm(country, city, controller=None):
> form = widgets.TableForm(fields=[UserField(), PasswordField()],
> action="save")
> return form
>
> But then I get errors. If I take away the PasswordField(), then it
> all
> works. I'm probably not doing the syntax right in some way, but I
> can't figure out why.
WidgetLists subclass "list" so the normal syntax for concatenating
lists applies:
form = widgets.TableForm(fields=UserField() + PasswordField(),
action="save")
Alberto
--~--~---------~--~----~------------~-------~--~----~
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?hl=en
-~----------~----~----~----~------~----~------~--~---