Hi Chris.

Am just starting too look at deform in some detail and I have question.

One of the things I have struggled with formish has been the fact I
can't easily
define a source of values for widgets like checkbox or validators such
as OneOf to
only be resolved late at render time. And I can't see how I would go
about it with deform.

In your example http://docs.repoze.org/deform/app.html you have
 colors = (('red', 'Red'), ('green', 'Green'), ('blue', 'Blue')) used
as values for

widget.RadioChoiceWidget values and for the validator OneOf

So in my contrived example I would like the set of possible values
for color is dependent on the
user and some other factor.  Looking at the code for SelectWidget and
RadioChoice widget
it appears they won't take a callable and lazily render those values
at render time.

With formish I basically constructed the form structure (schema)
but only applied widget definitions  and validators just before render
time. So that I could use things
like the current context to determine values for validation or
choices.  This was a bit of a hack.

So do you have a strategy or suggestion on how to approach this use case ?

I suppose I could work with imperative schema definition performed
late, but I much prefer to work with classes.
(I currently generate Formish (structures) directly from UML).


Repoze-dev mailing list

Reply via email to