views:

163

answers:

2

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.

+1  A: 

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()

ABentSpoon
A: 

Hi,

I'm having a similar issue, though I'm using evoque as my templating engine. I'm trying to perform conditional includes of CSS and Javascript files in the template by using the url to determine which file needs to be included. I tried using pylons.url.current() in the template, but that generated an error.

Is there a way to access the /{controller}/{action} information in the template so I can do the kind of conditional includes I'm talking about above?

Thanks in advance! Doug

Doug Farrell