We Recommend

Learning Python Learning Python
The authors of Learning Python show you enough essentials of the Python scripting language to enable you to begin solving problems right away, then reveal more powerful aspects of the language one at a time. This approach is sure to appeal to programmers and system administrators who have urgent problems and a preference for learning by semi-guided experimentation.


Posted By

ches on 08/06/07


Tagged

python validation pylons formencode


Versions (?)


Who likes this?

1 person has marked this snippet as a favorite

lukaszkorecki


FormEncode Email Address validation schema


Published in: Python 


URL: http://wiki.pylonshq.com/display/pylonsdocs/Form+Handling

model/form.py is a good place to put schemata in a pylons app: easy to build with inheritance and accessible to controllers via model.form.EmailForm, etc. See the link for further info on the extrafields options -- this one is intended for just two fields: a text field and submit button.

  1. import formencode
  2.  
  3. class EmailForm(formencode.Schema):
  4. allow_extra_fields = True
  5. filter_extra_fields = True
  6. email = formencode.validators.Email(not_empty=True)

Report this snippet 

You need to login to post a comment.