简体   繁体   English

如何在python的mako模板系统中访问当前URI?

[英]How can I access the current URI in python's mako templating system?

I'd like to submit the form to the current URI, like this: 我想将表单提交到当前URI,如下所示:

<form action="${CURRENT_URI}" method="post">
<input type="text" name="email" />
</form>

from within a mako template. 从mako模板中。 But I am not sure what variable holds the current uri information. 但是我不确定哪个变量可以保存当前的uri信息。

Thanks. 谢谢。

Actually, you don't need it. 实际上,您不需要它。

<form action="" method="post">
<input type="text" name="email" />
</form>

If you leave the action empty, it will be posted to the current url. 如果将操作留空,它将被发布到当前URL。

However, if you need the current url for some other reason, it can be retrieved by calling pylons.url.current() 但是,如果由于其他原因需要当前网址,则可以通过调用pylons.url.current()进行检索。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM