Kevin Dangoor wrote:
> I'm not completely done with the widgets work, but I think the main
> API is looking a lot better. I wanted to open up for comments,
> suggestions and patches.
>
> First of all, you can "activate" the new widgets code like this:
> from turbogears import widgets
> widgets.use_new_widgets()
>
> So, what's different?
>
> * create_dict is gone! it has been replaced by adjust_value and
> update_data. Subclassing is much cleaner now, I think

Hurra. :-)

>
> * all of those crazy parameters to create_dict, insert and render have
> been eliminated. Just pass in appropriate keywords for your widgets.
> (the value parameter for the first parameter is still supported, of
> course...)
>

Regarding this, since we support options at the constructor I think we
should also add options here at display time (and fix the problem with
_collect_options making options a property see #490).

That's just to provide a default suggested way of passing options (of
any type, choices for a selectfield) along from a form to it's fields
as the actual form I made does. What do you think?

I mean:

    def display(self, value=None, options=None, convert=True, **kw):

Just to be coherent:

default -> value
options -> options

>
> * form.widgets is now form.widgets["fields"]
>
> * disabled_fields on forms has become disabled_widgets

I left it to be disabled_fields AFAIK. :-/

>
> Limitations:
>
> * the select widgets are untested, as far as I know. they're probably
> broken and, at the very least, they don't support callables as they
> should
>

I noticed they don't work anymore as on my initial implementation (that
Alberto tested), anyway I will left the selection field to you so you
can check things, the CheckBox is now broken also (still using
create_dict and not respecting the default value), I'm cooking a patch
(with a test to show the supposed behavior).

Great work by the way.

Ciao
Michele

Reply via email to