On Tue, 2010-09-07 at 20:37 +0800, Tim Hoffman wrote:
> Bummer ;-)
> 
> 
> I don't think I have a developed an application in the last 10 years
> that hasn't has to do this.
> I was quite surprised when I discovered this feature was missing in
> formish, but it seems to be missing in quite a
> few other form libs like wtforms as well.

Technically, the feature you want isn't actually missing from any of
those systems, you'd just prefer a different spelling.  I can empathize
with this.

Currently deform requires that you construct widgets and validators that
need "context" info within "view" code, and then you need to attach
these late-created objects to a previously
otherwise-declaratively-defined schema.  You'd instead like to be able
to define "everything" declaratively at module scope.  While that's not
currently possible, it is on my radar to also be able to allow folks do
such a thing.  I haven't quite figured out how to do it while still
retaining the ability for Deform to be used on a variety of web
frameworks, but I expect I soon will.

- C


> I suppose at least they all have declarative method of defining the
> schema, but it does mean the actual schema definition is a bit more
> obscured.
> 
> Cheers
> 
> T
> 
> 
> 
> 
> On Tue, Sep 7, 2010 at 8:20 PM, Chris McDonough <chr...@plope.com> wrote:
> > Hi Tim,
> >
> > Sorry, there is no built-in solution that will allow you to use
> > declarative-module-scope code only.  You'll need to generate schemas and
> > widgets at render time.
> >
> > - C
> >
> >
> > On Tue, 2010-09-07 at 12:56 +0800, Tim Hoffman wrote:
> >> 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).
> >>
> >> Cheers
> >>
> >> Tim
> >> _______________________________________________
> >> Repoze-dev mailing list
> >> Repoze-dev@lists.repoze.org
> >> http://lists.repoze.org/listinfo/repoze-dev
> >>
> >
> >
> >
> 


_______________________________________________
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev

Reply via email to