GAE is converting Integers to Longs and len() breaks

18 views
Skip to first unread message

davedigerati

unread,
Aug 17, 2013, 4:06:29 PM8/17/13
to web...@googlegroups.com
My app is working locally fine with a field defined as
    Field('Q2V','integer'),

then in the controller I have been able to 
    len(Q2V)

but after upload to Google App Engine I am tripping with
    object of type 'long' has no len()

I've been abel to discover that apparently GAE will map Integers to Longs for python- um, ok, so how can I measure the length then? Has anyone run into this and solved it?

Jonathan Lundell

unread,
Aug 17, 2013, 4:14:21 PM8/17/13
to web...@googlegroups.com
Python integers don't have len either. What are you trying to do?

David Gawlowski

unread,
Aug 17, 2013, 4:40:58 PM8/17/13
to web...@googlegroups.com

Shoot, thanks, you're right, that field was a string and I changed it to do math on elsewhere...

Do you know how to take the far right number of a two digit number?  Will something like field[-1] work like it does on strings?

--
 
---
You received this message because you are subscribed to a topic in the Google Groups "web2py-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/yw40xBWIQQA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to web2py+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Jonathan Lundell

unread,
Aug 17, 2013, 5:08:35 PM8/17/13
to web...@googlegroups.com
On 17 Aug 2013, at 1:40 PM, David Gawlowski <hyp...@gmail.com> wrote:

Shoot, thanks, you're right, that field was a string and I changed it to do math on elsewhere...

Do you know how to take the far right number of a two digit number?  Will something like field[-1] work like it does on strings?

You can always do len(str(thing)), or str(thing)[-1] (though thing % 10 might be closer to what you want).
Reply all
Reply to author
Forward
0 new messages