Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/google-app-engine/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
将参数传递给python处理程序_Python_Google App Engine_Handler_Webapp2 - Fatal编程技术网

将参数传递给python处理程序

将参数传递给python处理程序,python,google-app-engine,handler,webapp2,Python,Google App Engine,Handler,Webapp2,我通过表值中的链接调用处理程序,如下所示: <td><a id="{{ test['test_name'] }}" href="/regex" >{{ test['test_name'] }}</a></td> 处理程序有一个SQL查询,我希望根据单元格的id或值运行该查询,因此当单击链接时,它会发送唯一的名称。我试图阅读关于URI路由的webapp2文档,但不明白如何将其应用于我的问题 在上的文档中,示例显示: app = webapp2.

我通过表值中的链接调用处理程序,如下所示:

<td><a id="{{ test['test_name'] }}" href="/regex" >{{ test['test_name'] }}</a></td>

处理程序有一个SQL查询,我希望根据单元格的id或值运行该查询,因此当单击链接时,它会发送唯一的名称。我试图阅读关于URI路由的webapp2文档,但不明白如何将其应用于我的问题

在上的文档中,示例显示:

app = webapp2.WSGIApplication([
    (r'/', HomeHandler),
    (r'/products', ProductListHandler),
    (r'/products/(\d+)', ProductHandler),
])
对于处理程序,您可以使用:

app = webapp2.WSGIApplication([
    (r'/regex/<test>', RegexHandler),
])
app=webapp2.WSGIApplication([
(r'/regex/',regexpunndler),
])
然后,您可以使用以下方法将其称为:

<a href="/regex/{{ test['test_name'] }}" >{{ test['test_name'] }}</a>

id=“…”
属性不是作为URL的一部分传递的,它是一个HTML属性。)


注意:您可能需要URL编码参数
test['test\u name']

我在创建处理程序路由时使用此参数:('/regex/(\d+),handler),但当我在我的href链接中调用它时,它会在URL中拾取测试['test\u name']。“我如何正确地从我的href中调用它?”?我把它记为href=“/regex/{test['test_name']}”