Inside your XML(), you have a list of lists. XML() will ultimately call the 
__str__ method on each item in it, and the __str__ method of a list calls 
the __repr__ method of each item in the list. The __repr__ method of long 
appends an "L" to the integer value. So, as you have discovered, you must 
first convert the long to an int. Note, if your row ID happens to exceed 
the maximum int size, the conversion won't do anything, and you'll still 
get an "L" appended. Another option is to use str(row.id), though that will 
put quotes around the integer, which you may not want.

Anthony

On Wednesday, June 19, 2013 4:13:43 AM UTC-4, palomar wrote:
>
> why I shouldn't convert it to an INT? It is the ID of my table and I need 
> it as integer (as on the preview version) to send it to my javascript 
> function... 
>
> Il giorno martedì 18 giugno 2013 18:40:06 UTC+2, Derek ha scritto:
>>
>> If you aren't using google app engine, then that should be okay. However 
>> if you are, you shouldn't convert it to an INT because you'll get errors.
>>
>> The "L" means it's a LONG and not an INT.
>>
>> On Tuesday, June 18, 2013 7:11:14 AM UTC-7, palomar wrote:
>>>
>>> I've just updated to 2.5.1 and I found this problem:
>>> Inside my site  have a google map and I need to add an array with 
>>> several marker;
>>> in my controller I have a simple query with a cycle
>>> def mappa:
>>>     markers=[]
>>>     for row in db().select(db.produttori.ALL):
>>>        markers.append([row.id, row.lat, row.lng])
>>> return dict(markers=XML(*[markers]))
>>>
>>> and I obtein ID + L, like this:
>>> [1L, '12.5', '7.6']
>>>
>>> so I need to do int(row.id)
>>> In the older version worked well...
>>> s.
>>>
>>>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to