Search code examples
pythongoogle-app-engineweb2py

Fixing cursor issues in Web2Py on Google AppEngine?


I have a simple UI for interacting with a database set up on a Google AppEngine application using Web2Py. I'm using the default Grid builder to settings to display it. Here is my full controller function:

@auth.requires_login()
def managePeople():

  # To hide the ID column from being seen on this page
  db.People.id.readable = False
  db.People.id.writable = False

  people = SQLFORM.grid(db.People, paginate = 15)

  # To allow for CSV imports on this page
  if request.vars.csvfile != None:
    db.People.import_from_csv_file(request.vars.csvfile.file)
    response.flash = 'Data uploaded'

  return dict(people=people)

I have over 15 records in the database, so when it's rendered it does correctly cut off just 15 people and displays the next button in the bottom of the grid. But when I click on it I get a:

Query Not Supported: Unknown configuration option ('cursor')

error.

The resulting url was something like:

http://localhost:8080/peopleapp/ui/managePeople?cursor=Cursor%28%3CCjUSL2oWZGV2fmdyYWRzdHVkZW50Y2hlY2tpbnIVCxIIU3R1ZGVudHMYgICAgICAoAoMGAAgAA%3D%3D%3E%29&page=2&_signature=f3916524c6c595a8f15ed3acc2750b0d49af7702

I looked into this and apparently cursor is no longer an option in GAE according to this page: NDB Query Class. I tried manually changing the option cursor in the url to start_cursor since this is one of the new supported options. After doing this it loads without any errors, but it just displays page 1 again instead of moving on to the second page.

At this point I was thoroughly confused and couldn't think of how to continue. Any suggestions or help is welcome. I'm sure I could build something like grid but I really don't want to if I have the option of using this robust built-in tool.


Solution

  • This issue was fixed by updating to Web2Py v2.11.2