hi all. i have an interesting problem with & in gae and wanted to see
if i could get some thoughts.

in my program, i have used & in queries many times and had it work.
for example, query A works fine:
(A) db((db.timeframe.isActive==True) &
(db.timeframe.userID==15)).select()

but query B does not:
(B) db((db.auth_user.id==1) & (db.auth_user.friends==2)).select()

in this example, the auth_user table has been adjusted to include a
GAEListProperty called friends. user with id 1 (user1) and user with
id 2 (user2) are friends.

if i call this query:
(C) db((db.auth_user.id==1).select()
it returns user1.

if i call this query:
(D) db((db.auth_user.friends==2).select()
it returns user1.

but if i put them together into query E:
(E) db((db.auth_user.id==1) & (db.auth_user.friends==2)).select()
it returns no one.

if i change either variable to use another custom field, points:
(F) db((db.auth_user.points==0) & (db.auth_user.friends==2)).select()
(G) db((db.auth_user.id==1) & (db.auth_user.points==0)).select()
it returns user1.

and if i use an inequality:
(H) db((db.auth_user.id>0) & (db.auth_user.friends==2)).select()
it returns user1 (and anyone else who is friends with user2).

so the only problem is the case i need, which is to see if user1 is
friends with user2. i can easily solve this with a loop but it seems
silly when i should be able to just use the DAL. can anyone see why
query E won't work when all the rest will? is it possible it's an
implementation issue?

thanks,

matt

Reply via email to