0

我明白了:

AttributeError: 'list' object has no attribute 'cursor'

在这条线上:

company_cursor = companies.cursor()

运行以下代码时:

q = Company.all()
q.order("datetime")
companies = q.fetch(5)

company_cursor = memcache.get("company_cursor")

if company_cursor:
    companies.with_cursor(start_cursor = company_cursor)

for company in companies: 
    do_stuff(company)

company_cursor = companies.cursor() 
memcache.set("company_cursor",company_cursor, 11000)

据我所见,我的代码类似于此处显示的示例:

https://developers.google.com/appengine/docs/python/datastore/queries

4

1 回答 1

1

您的查询是q,但fetch在查询中返回实体列表,因此companies实际上是列表。

要使游标成为查询的一部分,您需要在运行 fetch 之前添加它。

于 2013-11-05T18:57:59.110 回答