ryeguy
ryeguy

Reputation: 66861

SQLAlchemy/Elixir validation rules?

I just found out how to validate my database input before saving it, but I'm kinda bummed to find there are no premade rules (like validate email, length, etc) that are found in some web based frameworks. Are there any validation libraries laying around anywhere or somewhere that some premade validation lists are hiding that I haven't found yet?

Upvotes: 1

Views: 1112

Answers (1)

Ali Afshar
Ali Afshar

Reputation: 41663

Yes. There are. But keep your validation separate from your data layer. (As all the web frameworks do.)

Now the libraries you can use for validation are the exact form libraries from the web frameworks. Start with:

And a lot of others have sprung up recently, but most of them also deal with some degree of form generation. My personal favourite is WTForms.

On an interesting note, Formencode actually came from being the validation library for the (now) lesser-used SQLObject library, so it certainly has some traction and usage in this exact domain.

Upvotes: 3

Related Questions