I noticed that: >>> 5.1 5.0999999999999996 >>> "%(data)s" % dict(data=5.1) '5.1' >>> "%(data)e" % dict(data=5.1) '5.100000e+00' >>> "%(data)f" % dict(data=5.1) '5.100000' >>> "%(data).3f" % dict(data=5.1) '5.100' >>> "%(data).3e" % dict(data=5.1) '5.100e+00'
So when the number is printed it is printed fine. The internal representation is what it is. Massimo On Oct 20, 11:07 pm, Jonathan Lundell <jlund...@pobox.com> wrote: > On Oct 20, 2009, at 8:32 PM, mdipierro wrote: > > > > > I am ok with the patch. Perhaps for date and datetime we could also > > have a %(format)s that inserts the actual format string after some > > beautification, but I can add that later. > > I've created some of the doctests. One anomaly (not surprising, > really) is this one: > > >>> IS_FLOAT_IN_RANGE(1,5)(5.1) > (5.0999999999999996, 'enter a number between 1.0 and 5.0') > > Do we care? > > > > > massimo > > > On Oct 20, 9:25 pm, Jonathan Lundell <jlund...@pobox.com> wrote: > >> On Oct 20, 2009, at 5:24 PM, mdipierro wrote: > > >>> please email it to me when done. Thanks. > > >> Are you OK with the patches? I don't want to do the doctests until > >> they're settled, since the error messages figure in the tests. > > >>> On Oct 20, 6:42 pm, Jonathan Lundell <jlund...@pobox.com> wrote: > >>>> On Oct 20, 2009, at 2:17 PM, mdipierro wrote: > > >>>>> OK. I will take the patch. > > >>>> Here's a first cut:http://lobitos.net/web2py-patches/gluon/ > >>>> validators.py > > >>>> This is *not* ready to go; once we agree on the patch, I'll update > >>>> the > >>>> doctest strings accordingly. > > >>>>> On Oct 20, 3:38 pm, Jonathan Lundell <jlund...@pobox.com> wrote: > >>>>>> On Oct 20, 2009, at 12:04 PM, Yarko Tymciurak wrote: > > >>>>>>> "integer" is fine and appropriate, and not at all "techie" - if > >>>>>>> you > >>>>>>> went to grade school in the US, you would understand "integer" > >>>>>>> perfectly. I expect the same would be true of any translation > >>>>>>> of > >>>>>>> the same. > > >>>>>> I don't have a strong feeling on the question, though I'm not > >>>>>> sure > >>>>>> that my mother could define 'integer', and she graduated from > >>>>>> high > >>>>>> school (quite some time ago). FWIW, 'whole number' is perfectly > >>>>>> good > >>>>>> English (and lower grade level than 'integer'; notice that it's > >>>>>> the > >>>>>> dictionary definition of 'integer'). > > >>>>>> More generally, I was looking at the validation error messages, > >>>>>> and > >>>>>> have some suggestions. I'll generate a patch if you like. Here's > >>>>>> the > >>>>>> (sorted) list: > > >>>>>> cannot be empty! > >>>>>> input a number between %(min)s and %(max)s > >>>>>> input an integer between %(min)s and %(max)s > >>>>>> invalid email! > >>>>>> invalid expression! > >>>>>> invalid expression! > >>>>>> invalid filename or extension! > >>>>>> invalid image! > >>>>>> invalid IPv4 address! > >>>>>> invalid length! > >>>>>> invalid url! > >>>>>> invalid url! > >>>>>> invalid url! > >>>>>> must be alphanumeric! > >>>>>> must be HH:MM:SS! > >>>>>> must be YYYY-MM-DD HH:MM:SS! > >>>>>> must be YYYY-MM-DD! > >>>>>> value already in database! > >>>>>> value not allowed! > >>>>>> value not in database! > > >>>>>> Comments: > > >>>>>> 1. If it were up to me, I'd remove all the exclamation marks; > >>>>>> there's > >>>>>> no need to be excited about a mis-entry; we're just providing > >>>>>> information. > > >>>>>> 2. IS_LENGTH should perhaps give the use the same range info that > >>>>>> the > >>>>>> number-range messages do. > > >>>>>> 3. 'enter a number' rather than 'input a number'. > > >>>>>> 4. In general, 'enter <something>' is more helpful and friendly > >>>>>> than > >>>>>> 'invalid <whatever>'. It's not possible in every case, but in > >>>>>> many > >>>>>> cases we could do it. Example: 'enter a valid email address'. > > >>>>>>> On Tue, Oct 20, 2009 at 12:59 PM, mdipierro > >>>>>>> <mdipie...@cs.depaul.edu> wrote: > > >>>>>>> You may be right but to me "whole number" does not sound good. > >>>>>>> Anyway, > >>>>>>> one can use internationalization to fix this. > > >>>>>>> I wish like there are "en-en", "en-us", there were "en-us-tech" > >>>>>>> and > >>>>>>> "en-us-non-tech". (Perhaps I should patent this!) > > >>>>>>> Massimo > > >>>>>>> On Oct 20, 12:38 pm, Jonathan Lundell <jlund...@pobox.com> > >>>>>>> wrote: > >>>>>>>> On Oct 20, 2009, at 10:34 AM, mdipierro wrote: > > >>>>>>>>> ok. > > >>>>>>>> My intuitive sense is that more users are likely to understand > >>>>>>> "whole > >>>>>>>> number" than "integer". We all take the meaning of integer for > >>>>>>>> granted, but I wonder whether it isn't a little on the > >>>>>>>> technical > >>>>>>> side > >>>>>>>> for my Aunt Polly. > > >>>>>>>>> On Oct 20, 12:19 pm, Jonathan Lundell <jlund...@pobox.com> > >>>>>>>>> wrote: > >>>>>>>>>> On Oct 20, 2009, at 10:16 AM, mdipierro wrote: > > >>>>>>>>>>> I think "integer number" is the proper way but I am not a > >>>>>>>>>>> native > >>>>>>>>>>> english speaker. Any english speaker can help us on this? > > >>>>>>>>>> Here's the (Oxford American) dictionary entry: > > >>>>>>>>>> integer |ˈɪntədʒər| > >>>>>>>>>> noun > >>>>>>>>>> 1 a whole number; a number that is not a fraction. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~----------~----~----~----~------~----~------~--~---