On Mon, Dec 12, 2011 at 7:11 AM, Chris McDonough <[email protected]> wrote: > On Mon, 2011-12-12 at 02:23 -0800, rihad wrote: >> Hi, all. Does Pyramid (or Sqlalchemy) offer any kind of model >> validation? Like, min/max value/length a numerical/textual value may >> have. > > I use Colander for this: > http://docs.pylonsproject.org/projects/colander/en/latest/ > > Folks also use FormEncode. > >> On the same note, how come there's no support for HTML forms? A >> form thing which would preferably grab fields from a model to avoid >> duplicating stuff. Or are we talking lightweight here? :) > > There's Deform: http://docs.pylonsproject.org/projects/deform/en/latest/ > (which uses Colander) or dozens of other form libraries (Formish, > WTForm, ToscaWidgets, pyramid_simpleform, the list goes on...) > > Pyramid has no canonical notion of "model", so that's not really a > Pyramid thing. But pyramid_formalchemy can create forms from SQLAlchemy > models. >
While, still pretty experimental and not considered stable (from the standpoint of the API being fixed, it does work just fine) limone provides a way to have validation directly on the models themselves. It uses Colander schemas. Effectively, it takes a Colander schema as an input and spits out a class which enforces the schema on instances of that class: https://github.com/Pylons/limone Chris -- 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.
