Le 16 août 08 à 18:27, Andreas Petermann a écrit :
Hi list,
i am new to plone and i am wondering if it is possible to add a
standard validator to every field without adding it to the field
definitions? I know it is possible to define a new field class which
uses the special validator as the default one but i do not want to
define for every existing field a new one.
subclassing the original field, adding the validator to your new
field, should do the job.
class EmailField(StringField):
_properties = StringField._properties.copy()
_properties.update({'validators': ('emailvalidator',)})
I let you add the appropriate imports
Of course, you should define and register your validator.
regards
Pete
_______________________________________________
Product-Developers mailing list
[email protected]
http://lists.plone.org/mailman/listinfo/product-developers
--
Gilles Lenfant
INGENIWEB (TM) - SAS 50000 Euros - RC B 438 725 632
Bureaux de la Colline
1 rue Royal
92210 Saint Cloud - France
Phone : 01 78 15 24 00 / Fax : 01 46 02 44 04
web : www.ingeniweb.com - une société du groupe Alter Way
_______________________________________________
Product-Developers mailing list
[email protected]
http://lists.plone.org/mailman/listinfo/product-developers