Em Sexta 28 Abril 2006 16:30, Michele Cella escreveu:
> "Don't use nested WidgetsList"
:-) This should be stated at the docs. Very clearly.
> This solves all problems, and again as I've said I can't see the
> benefit of nesting them, looks ugly and somewhat harder to understand
> to me. ;-)
With the subclassing solution pointed out I'm happy. It works for me. ;-)
> [1]
> At the moment you can do:
>
> class Fields(WidgetsList):
> name = TextField(name="hello")
>
> and the TextField's name is not "name" but "hello"
I know this. :-) I'm not willing to change the name, but avoiding duplicate
declarations for the same thing. The more duplicates, the worst the
maintenance will be since there are more points of failure.
What I'll do is:
class Fields(TextField):
"""
<basic doc>
Note that this requires that this class be wrapped inside a list to be
used with a form: [Fields()].
"""
name = 'name'
option1 = ...
So, I'm subclassing *and* documenting the use for this widget. :-)
I'll be very happy with the statement that even though WidgetsList *appears*
to be a list, they have some particularities and shouldn't be used like lists
and neither nested.
--
Jorge Godoy <[EMAIL PROTECTED]>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"TurboGears Trunk" 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-trunk
-~----------~----~----~----~------~----~------~--~---