简体   繁体   中英

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:

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

from within a mako template. But I am not sure what variable holds the current uri information.

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.

However, if you need the current url for some other reason, it can be retrieved by calling pylons.url.current()

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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