views:

21

answers:

1

http://code.google.com/appengine/articles/update_schema.html

Trying to work this out for a nice little updater across my web application. The only difference is rather than sorting on a StringProperty as shown in the example I am using an IntegerProperty.

No matter which way round I turn the query I cannot get it to respond correctly to my filters.

bfid = self.request.get("bfid", None)
if bfid == None:
  q = Course.all()
  q.order("-bfid")
  result = q.get()
  bfid = result.bfid

q = Course.all()
q.filter("bfid <=", bfid)
q.order("-bfid")
results = q.fetch(limit=2)

for result in results:
  print result.bfid

No matter what the bfid is, say 10, the two results it returns are 61, 62 which are the largest numbers in the set.

What have I done wrong???

+2  A: 

You need to convert bfid to int; self.request.get() returns a string.

You also have a problem with your logic; if bfid is None the query will be done twice, the second time with all results less than or equal to None. (This isn't what's causing your problem here, though.)

Wooble
oh sweet, doh! too used to php. oh i see what you mean about double query, just following the example, but i see why you says its not needed.
esryl