数据存储区(ndb)将换行符插入内容(类型:TextProperty)

时间:2012-10-07 02:33:57

标签: google-app-engine google-cloud-datastore

我的模型看起来像这样:

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

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

{{ bar|safe }}

我'放'this

<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修改文本,输出this

<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。

2 个答案:

答案 0 :(得分:1)

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

答案 1 :(得分:0)

它不是NDB - 数据存储区也没有对你的文本做过这样的事情。它看起来像某种内容编码,特别是引用打印,可能是由浏览器应用的?