[Zope3-Users] Automatic schema field sanitation?
Dennis Noordsij
dennis.noordsij at movial.fi
Tue Dec 2 10:52:01 EST 2008
Christian Klinger schreef:
> Hi Dennis,
>
> i think you can try to add a new Field and a corresponding Widget for
> your needs.
>
> I think this could be a good starting poing.
>
> http://wiki.zope.org/zope3/fieldsandwidgets.html
>
> If you have further questions - please ask.
Hi Christian,
Thanks for your answer
I have the new Field, and its constraint, but I would like to sanitize
the value before the form layer, i.e. I don't know if all input comes
through a form, and certainly not all output goes via a form, so
sanitizing the value via a widget (data converter) will not cover all
the cases.
Example:
class Code(TextLine):
def constraint(self, value):
super(Code, self).constraint(value)
if not validate_regex(value):
raise InvalidCode(value)
Now how to plug in another method at the final steps of the "set"
behaviour to rewrite the value?
Cheers,
Dennis
More information about the Zope3-users
mailing list