Em Friday 01 February 2008 07:08:19 Glauco escreveu:
> i want to use exponential format in a texfield validated but i found an
>
> issue:
>  >>> from turbogears import validators as v
>  >>> v.Int().to_python('12')

Here you input a string.

> 12
>
>  >>> v.Int().to_python(1e6)

Here you input a number.

>
> 1000000
>
>
> OK, validator can handle exponential format, but i think that TG
> transform all in string so internally he don's see the exponential

It is not TG.  All that comes from the web are strings.  This is one of the 
reasons why we need validators.  Besides validating specific things, they 
cast the information to the correct data type.


This is not a TG bug:

[EMAIL PROTECTED]:~> python
Python 2.5.1 (r251:54863, Sep 22 2007, 01:43:31) 
[GCC 4.2.1 (SUSE Linux)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> int('1e6')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: invalid literal for int() with base 10: '1e6'
>>> 



-- 
Jorge Godoy      <[EMAIL PROTECTED]>


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to