Chapter 16.4.2. More Validators

Sometimes you need more than an Int() validator. Fortunately, FormEncode provides a number of built-in validators that you can use. Not only that, it provides you with a simple mechanism for creating your own validators.

More often than not one of the built-in validators can give you what you need—the regex validator is particularly flexible. If you want to check that the user entered a valid number, a valid date, a valid URL, or a valid e-mail address, there are built-in validators to help you.

The most-up-to date list of built-in validators is available at www.turbogears.org/docs/api/formencode.validators-module.htm. Here’s a list of the most commonly used validators:

  • Constant— If you want to ignore the ...

Get Rapid Web Applications with TurboGears: Using Python to Create Ajax-Powered Sites now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.