1

我有一个看起来像这样的模型:

class Foo(ndb.Model):
    bar = ndb.TextProperty(required=True)
    # other properties

我正在使用 jinja2 进行模板化:

{{ bar|safe }}

我“放入”这个

<p>I think it is always going to be challenging planning a wedding in a foreign country. 1234 Weddings was able to pre-arrange everything before our arrival and even meet us at the airport to attend to last minute details.<br> The wedding itself was even more amazing than we could have imagined and flawless. For our day, 1234 Weddings became a part of our family and our memories. We are so greatful for the professional communication and creativity that made our day so special.</p>

ndb 破坏文本,输出

<p>I think it is always going to be challenging planning a wedding in a for=
eign country. 1234 weddings was able to pre-arrange everything before our a=
rrival and even meet us at the airport to attend to last minute details.<br=
>The wedding itself was even more amazing than we could have imagined and f=
lawless. For our day, 1234 Weddings became a part of our family and our mem=
ories. We are so greatful for the professional communication and creativity=
 that made our day so special.</p>

这只发生在我部署的站点上。localhost 上的相同代码不会产生此问题。

可能相关:

  • 我的本地应用程序引擎没有持久数据存储。
  • bar 最初是“StringProperty”类型。在将类型更改为“TextProperty”后,我注意到了这个问题,但在更改之前没有进行广泛的测试,因此问题可能在此之前就存在。

任何帮助,将不胜感激。
TIA。

4

2 回答 2

1

Blobstore 上传处理程序中有一个错误导致同时提交的文本出现编码问题,这里的评论有一个过去对我有用的补丁:http ://code.google.com/p/googleappengine/issues /detail?id=2749

于 2012-10-09T06:01:45.140 回答
0

它不是 NDB——它也不是 Datastore 对您的文本做这样的事情。它看起来像是某种内容编码,特别是引用打印,可能由浏览器应用?

于 2012-10-07T23:38:47.733 回答