[Zope3-Users] Re: formlib vs. cancel button

Martin Aspeli optilude at gmx.net
Thu Feb 15 18:44:34 EST 2007


Maciej Wisniowski wrote:
>>>     @form.action("Cancel", validator=None)
> -1 from me
> 
> Currently above code is same as:
>>>     @form.action("Cancel")
> 
> So I think this is a very common pattern that means:
> do standard validation, do not use additional action validator.

Yes. I think you misunderstand my suggestion.

Currently,

	@form.action("Cancel")

is the same as

	@form.action("Cancel", validator=None)

I think it's fairly unlikely that someone *wanted* the default 
validation and *explicitly* used the second syntax. To say 
validator=None and get a default validator is fairly un-intuitive.

I'm proposing that if you *explicitly* pass validator=None, you get no 
validator. The way the code works currently from what I can tell, the 
easiest way of achieving that would be if the default for which the 
fallback is invoked is not "None" but is some "_marker". This is a 
fairly common pattern.

Martin



More information about the Zope3-users mailing list