Back to index

plone3  3.1.7
validators.py
Go to the documentation of this file.
00001 def update_only_validator(form, action):
00002     """Only validate an action when updating a form.
00003 
00004     This allows you to create an action without having formlib render a
00005     button for it.
00006     """ 
00007     return "form_result" not in form.__dict__
00008 
00009 
00010 def null_validator(*args, **kwargs):
00011     """A validator that doesn't validate anything.
00012     
00013     This is somewhat lame, but if you have a "Cancel" type button that
00014     won't want to validate the form, you need something like this.
00015 
00016     @form.action(_(u"label_cancel", default=u"Cancel"),
00017                  validator=null_validator,
00018                  name=u'cancel')
00019     """
00020     return ()