Here is my actual controller, it iterates perfectly on a web2py
server, but as soon as upload the exact same files to GAE it doesn't
iterate.
***********************
def livesearch():
'''Auto completes the search query'''
partialstr = request.vars.partialstr
query = db.listing.title.like('%'+partialstr+'%')
titles = db(query).select(db.listing.ALL)
items = []
for title in titles:
items.append(DIV(A(title.title, _id="livesearch_item",
_href=URL('search', args=title.title.replace(' ','-')))))
return TAG[''](*items)
***********************
I just realised I'm getting this error on GAE:
def LIKE(self,first,second): raise SyntaxError, "Not supported"
SyntaxError: Not supported
Does like() not work on GAE? How do I fix this? It works fine on the
web2py server.
On Aug 29, 5:24 am, howesc <[email protected]> wrote:
> here is what i just tried:
>
> db.define_table('menu_item',
> Field('created_on','datetime', default=request.now,writable=False),
> Field('name', length=500, notnull=True, unique=True,
> requires=IS_NOT_IN_DB(db, 'menu_item.name')),
> migrate=migrate)
>
> then in controller:
>
> def index():
>
> data=db(db.menu_item.created_on).select(orderby=~db.menu_item.created_on,
> limitby=(0,20))
>
> data2=db().select(db.menu_item.ALL,orderby=~db.menu_item.created_on,
> limitby=(0,20))
>
> return dict(data=data, data2=data2)
>
> then in view:
>
> {{=BEAUTIFY(response._vars)}}
>
> <h1>data</h1>
> {{for d in data:}}
> {{=d.name}}<br />
> {{pass}}
>
> <hr />
> <h1>data2</h1>
> {{for d in data2:}}
> {{=d.name}}<br />
> {{pass}}
>
> and got exactly what i was expecting. some things i noticed:
> - i don't think db(db.menu_item.created_on) is a valid query. it needs to
> be compared to something right? (i know it works, but it seems wrong to me)
> - print doesn't work on GAE (there is no console to output to in that
> environment) so i assumed you were either using logging or outputting in a
> view
>
> can you tell me more, or send me a minimal application that produces the
> problem and i'll try it out too? it sounds like something is up, so let's
> get to the bottom of it and get it fixed!
>
> christian