You can use:
if request.env.web2py_runtime_gae:
    records = [db.test[id] for id in test_ids]
else:
    records = db(db.test.id.belongs(test_ids)).select()


But that's messy so I opened an issue about BELONGS support here:
http://code.google.com/p/web2py/issues/detail?id=56

Turns out it's harder than it looks to implement a BELONGS wrapper
properly for GAE. For instance the sorting would have to be done in
Python. But I'd be happy with basic BELONGS support on GAE without
these frills.

Richard


On Oct 19, 5:26 pm, william wang <[email protected]> wrote:
> Hi everone,
>
> I am a newbie to w2p and gae. As a startup, i develop with the sqlite
> db, now i am trying to run it GaeLauncher.
> Belongs break, it confused me some time to find out gql doesn't
> implement it yet.
> Is it possible to add some more obvious exception string into the gql?
> Like "belongs() is not supported in GAE yet", so newbies like me will
> know what's going on immediately.
>
> And my question is:
> my db.py:
>
> db.define_tables('groups', Field('name'))
> db.define_tables('posts', Field('group_id', db.groups))
> db.define_tables('subscribes', Field('group_id', db.groups), Filed
> ('user_id', db.auth_user))
>
> What I am trying to do is find out all the latest posts in my
> subscribed groups (like twitter home timeline)
>
> # the codes doesn't work in gae
> #  user_subscribes = db(db.subscribes.user_id==auth.user.id)._select
> (db.subscribes.group_id)
> #  posts = db(db.posts.group_id.belongs(user_subscribes)).select
> (orderby=~db.posts.created_at)
>
> Can you guys help me out with a equal solution for GAE?
>
> Thanks,
> William
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py-users" 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/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to