亞歷克斯已經回答前不久,但如果別人來用了同樣的問題一起:
你只讓item_type
等於db.Text(如OP在評論中提到)。
這裏有一個簡單的例子:
from google.appengine.ext import db
class LargeTextList(db.Model):
large_text_list = db.ListProperty(item_type=db.Text)
def post(self):
# get value from a POST request,
# split into list using some delimiter
# add to datastore
L = self.request.get('large_text_list').split() # your delimiter here
LTL = [db.Text(i) for i in L]
new = LargeTextList()
new.large_text_list = LTL
new.put()
def get(self):
# return one to make sure it's working
query = LargeTextList.all()
results = query.fetch(limit=1)
self.render('index.html',
{ 'results': results,
'title': 'LargeTextList Example',
})
兩個海峽和unicode也被限制在500個字符。但後來我試着用db.Text作爲一種類型,到目前爲止它似乎工作。感謝您指點我正確的方向。 – MarcoB 2010-05-23 21:28:42