[Zope3-Users] Re: formlib vs. cancel button
Martin Aspeli
optilude at gmx.net
Thu Feb 15 17:10:22 EST 2007
Marius Gedminas wrote:
> I'd be happy to implement and commit something
Yay!
> but I'd be happier if
> someone else designed the API. When I try to design APIs myself, I tend
> to change my mind too often. Now I want
>
> @form.action("Cancel", validator=None)
>
> to mean "do no validation". But perhaps that's not backwards-compatible
> enough?
+1 This sounds sensible and intuitive and non-invasive. It was the first
thing I tried. :)
From my original debugging, I think the problem is that when
validator=None in formlib, it falls back on some default validator. I
suggest that the "default" validator is some _marker, e.g.
_marker = object
def action(name, ..., validator=_marker):
...
...
if validator is _marker:
validator = default_validator
Or some such. The only thing that'd break, probably, would be people who
*explicitly* set validator=None and expected the default validator,
which sounds like a pretty marginal case to me.
Martin
More information about the Zope3-users
mailing list