AppEngine: how do cursors work?

Posted by victor a.k.a. python for ever on Stack Overflow See other posts from Stack Overflow or by victor a.k.a. python for ever
Published on 2010-04-04T16:30:38Z Indexed on 2010/04/04 16:33 UTC
Read the original article Hit count: 244

Filed under:

hello, i have the following code

def get(self):
    date = datetime.date.today()
    loc_query = Location.all()

    last_cursor = memcache.get('location_cursor')
    if last_cursor: loc_query.with_cursor(last_cursor)
    loc_result = loc_query.fetch(1)

    for loc in loc_result:
        self.record(loc, date)
        taskqueue.add(
            url='/task/query/simplegeo',
            params={'date':date, 'locid':loc.key().id()}
        )

    if len(loc_result):
        memcache.add('location_cursor', loc_query.cursor())
        taskqueue.add(url='/task/count/', method='GET')
    else:
        memcache.add('location_cursor', None)

i don't know what i'm doing wrong, but i am getting the same cursor which is not the effect i wanted. why isn't the cursor moving?

© Stack Overflow or respective owner

Related posts about python