[Zope3-Users] z3c.form: Integer-based fields incorrectly validated

Hermann Himmelbauer dusty at qwer.tk
Wed Aug 8 05:26:53 EDT 2007


Am Mittwoch, 8. August 2007 05:45 schrieb Stephan Richter:
> On Wednesday 01 August 2007 13:15, Hermann Himmelbauer wrote:
> > In one of my forms, one field is defined like that:
> > "The entered value is not a valid integer literal."
> >
> > Interestingly, if I set "1,123" as value, zope outputs:
> >
> > "Objekttyp ist falsch."
> >
> > I tried to investigate this futher, but things are getting complicated at
> > the file "converter.py", line 96 (no clue what a formatter is).
> >
> > Is this a bug or am I doing something wrong?
>
> This error should really not occur. I think we have plenty of tests for
> this and z3c.form is used in production using this feature. Can you extract
> this problem into a test?

Yes, I reproduced it by simply modifying your HelloWorld example in the 
z3c.formdemo package:

Index: interfaces.py
===================================================================
--- interfaces.py       (Revision 78682)
+++ interfaces.py       (Arbeitskopie)
@@ -27,7 +27,7 @@
 class IHelloWorld(zope.interface.Interface):
     """Information about a hello world message"""

-    who = zope.schema.TextLine(
+    who = zope.schema.Int(
         title=u'Who',
         description=u'Name of the person sending the message',
         required=True)

Now the same validation problems occur for this input field.
Maybe the reason for this is my Zope3 version? I still use Zope-3.3.1. The z3c 
packages are all up to date, I use the latest SVN versions.

Best Regards,
Hermann

-- 
x1 at aon.at
GPG key ID: 299893C7 (on keyservers)
FP: 0124 2584 8809 EF2A DBF9  4902 64B4 D16B 2998 93C7


More information about the Zope3-users mailing list