I'm currently trying to modify the error message for converter errors in 
z3c.form. For instance, if I have an Int() field and input characters there, 
the message is:

The entered value is not a valid integer literal.

So, I'd like to write a message such as "Please enter numbers only".

I tried now to register a custom error class like this:
IntErrorMsg = error.ErrorViewMessage(
    u'Please enter numbers only.',
    error=zope.schema.ValidationError, field=IPerson['personnumber'])

zope.component.provideAdapter(IntErrorMsg, name='message')

The problem with this is, that the error I need to create the error class for, 
seems to be a zope.schema.ValidationError. This way, all errors are reported 
with the error class above, which is bad.

So, is there a more specific error class for converter errors (I could not 
find one)? Or is there a better way to solve my problem?

Best Regards,

GPG key ID: 299893C7 (on keyservers)
FP: 0124 2584 8809 EF2A DBF9  4902 64B4 D16B 2998 93C7
Zope-Dev maillist  -  Zope-Dev@zope.org
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope )

Reply via email to