我有一个约20个对象的列表,并且为每个对象返回一个包含10个词典的列表。
我想存储每个对象在GAE列表中的10个字典的列表;我认为我没有正确编写代码将这些信息存储到GAE。
以下是我有: 我的主要请求处理程序之前,我有这个类:在GAE中存储词典列表
class Tw(db.Model):
tags = db.ListProperty()
ip = db.StringProperty()
在我的主要请求处理我有以下几点:
for city in lst_of_cities: # this is the list of 20 objects
dict_info = hw12.twitter(city) # this is the function to get the list of 10 dictionaries for each object in the list
datastore = Tw() # this is the class defined for db.model
datastore.tags.append(dict_info) #
datastore.ip = self.request.remote_addr
datastore.put()
data = Data.gql("") #data entities we need to fetch
我不知道如果这个代码是根本写的。如果任何人可以请帮助它将不胜感激。
听起来像您的列表相当静态。为什么不把它存储在代码或数据文件中? – 2011-05-03 19:40:03