English 中文(简体)
go角灯发动机——如何从html式输入型号中获取清单
原标题:google app engine - how to get ListProperty from an html form s input type="text"

i 重复采用某种参数,采用html的形式,然后形成一个模范实体。 问题在于,无论谁试图,都会产生这样的错误:

BadValueError: Property xxx must be a list

这一模式:

 xxx = db.ListProperty(int)

这份名单所用的句子是:

xxx = self.request.get( xxx )

我的印象是,在提交纽伦时,html即是一阵。 因此,我如何能够从输入型“文字”中以html的形式获得一份清单? 如果写了1,1,1,1,1,1,1,1,4,1,1,4,1,1,5,4,5,5,5,5.

字典法与单列世界应用法类似,在使用表格在网页上张贴问候时,差异是,需要获得一份清单,而不是文本。

self.response.out.write("""
          <form action="/sign" method="post">
            <div><textarea name="content" rows="3" cols="60"></textarea></div>
            <div><input type="submit" value="Sign Guestbook"></div>
          </form>
        </body>
      </html>""")

class Guestbook(webapp.RequestHandler):
    def post(self):
        greeting = Greeting()

        if users.get_current_user():
            greeting.author = users.get_current_user()

        greeting.content = self.request.get( content )
        greeting.put()
        self.redirect( / )

这是否是使用户投入建立模范实体的最佳途径,以及如何确定该模型,以便其获得一个清单并在模型属性中撰写该清单?

问题回答

一旦一位专家向我表明:

tlist = map(lambda x: int(x), self.request.get_all( xxx ))

您应在<条码>xxx上填写名单,而不是打字或打字。

或许请您使用request_all 。 方法,而不是取而代之。





相关问题
CSS working only in Firefox

I am trying to create a search text-field like on the Apple website. The HTML looks like this: <div class="frm-search"> <div> <input class="btn" type="image" src="http://www....

image changed but appears the same in browser

I m writing a php script to crop an image. The script overwrites the old image with the new one, but when I reload the page (which is supposed to pickup the new image) I still see the old one. ...

Firefox background image horizontal centering oddity

I am building some basic HTML code for a CMS. One of the page-related options in the CMS is "background image" and "stretch page width / height to background image width / height." so that with large ...

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签