On GAE, this doesn't work:
rows = db((db.geoip.begin_num <= value) & (db.geoip.end_num >=
value)).select()
BadFilterError: BadFilterError: invalid filter: Only one property per
query may have inequality filters (<=, >=, <, >)..
So I broke the query into two queries:
ids = db(db.geoip.begin_num <= value)._select(db.geoip.id)
rows = db((db.geoip.end_num >= value) &
db.geoip.id.belongs(ids)).select()
I got the following error:
File "/home/skwong/web2py/applications/init/models/db.py", line 74, in
geoip
rows = db((db.geoip.end_num >= value) &
db.geoip.id.belongs(ids)).select()
File "/home/skwong/web2py/gluon/contrib/gql.py", line 346, in
belongs
return Query(self, 'IN', value)
File "/home/skwong/web2py/gluon/contrib/gql.py", line 570, in
__init__
right = long(right or 0)
TypeError: long() argument must be a string or a number, not 'tuple'
Is this expected?