我无法将文本添加到 textProperty

I cant add text to textProperty

我需要将大文本(70k 字符)存储到数据存储区。我所做的是在本地主机上运行良好。但是当我将它上传到 gae 时它不存储任何东西。它只显示“{}”

如果我将 textProperty 重命名为 StringProperty 并更改文本,它就可以工作。我哪里做错了?

我的db.model:

class Eyut(db.Model):
    texx=db.TextProperty()
    date = db.DateTimeProperty(auto_now_add=False)
    glink=db.StringProperty()

首先添加:

eks=Eyut(parent=_gazKey('yaz','yaze'),key_name='yaze')
eks.put()

正在向其中添加文本:

y=Eyut.get_by_key_name('yaze',parent=db.Key.from_path('Bed','yaz','yaze',1))
y.texx="any text"
y.put()

StringProperty

A short string. Takes a Python str or unicode (basestring) value of 500 characters or less.

TextProperty

A long string.

Unlike StringProperty, a TextProperty value can be more than 500 characters long.

您提供的代码还不够多,但稍加猜测,这是我重现您报告内容的最简单尝试:

class Bed(db.Model):
    name = db.StringProperty()

def _gazKey(x, y):
    return db.Key.from_path('Bed', x, y, 1)

class Eyut(db.Model):
    texx=db.TextProperty()
    date = db.DateTimeProperty(auto_now_add=False)
    glink=db.StringProperty()

class MainHandler(webapp2.RequestHandler):
    def get(self):
        eks=Eyut(parent=_gazKey('yaz','yaze'),key_name='yaze')
        eks.put()
        y=Eyut.get_by_key_name('yaze',parent=db.Key.from_path('Bed','yaz','yaze',1))
        y.texx="any text"
        y.put()
        self.response.headers['Content-Type'] = 'text/plain'
        self.response.write(y.texx + '\n')

此代码显示任何问题,尤其是您报告的问题 -- 实体及其文本 属性 符合预期。

请编辑您的问题以显示对此代码的最小更改,重现您报告的问题。