Regarding JSON support, it should be easy enough: perhaps a to_json()
method on the form that returns the current state as a dict, something
like:
{
success : false,
errors : {'name' : 'Your name is missing'},
data : {'email' : '...'}
}
On Jan 17, 10:19 am, Mike Burrows <[email protected]> wrote:
> Nice!
>
> When we've discussed validation here previously (you may recall that I
> took @validate to bits, allowed it to be used in ways other than as a
> decorator and added JSON support) I mentioned that one of the
> prerequisites would be agreement on idiomatic usage. I do like to
> have available the "undecorated" style that allows for some logic flow
> when validation fails, and wouldn't miss the decorator at all if that
> went. This looks nice, and much more complete than my solution.
>
> So will this (or something very much like it) get blessed as the way
> forward for Pyramid? And with JSON perhaps?
>
> Regards,
> Mike
> [email protected]http://twitter.com/asplakehttp://positiveincline.com
>
> On Jan 15, 1:42 pm, zeemonkee <[email protected]> wrote:
>
>
>
>
>
>
>
> > I've just released a small package,pyramid_simpleform:
>
> >http://pypi.python.org/pypi/pyramid_simpleform/
>
> > This is a small helper library which wraps FormEncode. It's intended
> > to replace the old @validate decorator used in Pylons, but uses a
> > similar pattern to Django forms, WTForms or Flatland.
>
> > The library includes a renderer helper class which uses webhelpers to
> > output HTML widgets, but you can render the form any way you like
> > (including htmlfill).
>
> > Thanks to everyone on #pyramid and #pylons IRC for their help with all
> > my questions.
--
You received this message because you are subscribed to the Google Groups
"pylons-discuss" 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/pylons-discuss?hl=en.