NDB 中的 TextProperty 字段获取“=";附加在每一行之后 [英] TextProperty field in NDB gets "=" appended after every line

查看:17
本文介绍了NDB 中的 TextProperty 字段获取“=";附加在每一行之后的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个非常奇怪的案例,我无法调试一天.

I have very strange case which I wasn't able to debug for a day.

在我的前端,我有带有 textarea 和提交按钮的表单.提交时,textarea 字段被保存为 ndb.TextProperty()当我提交多行文本时,数据库中的文本会在每一行上获得 ==20 字符.起初我以为它们是随机插入的,但似乎每 76 个字符都会得到一个 = 字符.

On my front-end I have form with textarea and submit button. On submission, the textarea field gets saved as ndb.TextProperty() When I submit a multiline text, the text in the database gets = or =20 characters on every line. At first I thought they get randomly inserted, but it seems every 76 characters gets one = character.

这真的很难调试,因为在我的本地主机实例上它工作得很好,但在部署的版本上却没有.它们是同步的.同样在我的 localhost 实例上,数据存储实体上的文本字段正确显示了换行符和制表符,但在部署版本上,数据存储字段显示为一个没有换行符或制表符的文本 blob.

This gets really hard to debug as on my localhost instance it works perfectly fine, but on the deployed version it doesn't. They are both in sync. Also on my localhost instance the text field on the datastore entity shows correctly the newline and tab characters, but on the deployed version, the datastore field is shown as one text blob without newlines or tabs.

谁能引导我走向正确的方向?

Anyone can guide me to the right direction ?

推荐答案

哦,BlobStoreHandler,你在最初的问题中没有提到这一点.

Oh, BlobStoreHandler you didn't mention that in your original question.

好的,这是你的问题.

我不相信您可以将两者结合起来.如果您要上传到 Blobstore,则不能执行其他表单元素,因为上传被定向到 BlobStore 服务.

I don't believe you can combine the two. If you are uploading to the Blobstore you can't do other form elements, as the upload is directed to the BlobStore service.

来自文档

用户通过提交包含一个的 HTML 表单来创建一个 blob或更多文件输入字段.您的应用程序调用 create_upload_url()获取此表单的目的地(动作),传递函数 a应用程序中处理程序的 URL 路径.当用户提交表单,用户浏览器直接上传指定文件到网店.Blobstore 重写用户的请求并存储上传文件数据,将上传的文件数据替换为一个或多个对应的 blob 键,然后将重写的请求传递给您提供给 create_upload_url() 的 URL 路径中的处理程序.这个处理程序可以根据 blob 键进行额外的处理.

The user creates a blob by submitting an HTML form that includes one or more file input fields. Your application calls create_upload_url() to get the destination (action) of this form, passing the function a URL path of a handler in your application. When the user submits the form, the user's browser uploads the specified files directly to the Blobstore. The Blobstore rewrites the user's request and stores the uploaded file data, replacing the uploaded file data with one or more corresponding blob keys, then passes the rewritten request to the handler at the URL path you provided to create_upload_url(). This handler can do additional processing based on the blob key.

因此,在没有看到您的代码的情况下很难准确说出正在发生的事情,但我严重怀疑您能否实现您想要实现的目标.

So it's difficult to say exactly what is going on without seeing your code, but I seriously doubt you can do what you are trying to achieve.

这篇关于NDB 中的 TextProperty 字段获取“=";附加在每一行之后的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆