I am trying to setup a login form that sits on each page (well, each
page while one is not logged in), up in the right hand corner.  This
seems easy enough, I grabbed the template from login.kid, changed the $
{previous_url} in the form action to /login and put it in
master.kid.

Problem was I didn't have a ${forward_url} hidden parameter in my
form.  Now for me I want to just forward right back to the current
page after a login is attempted, so forward_url needs to be the
current page.  I didn't want to add a current_page url  to every
controller I had b/c that seems ridiculous, I just need to get the
current url in the master.kid (which is where either a login form or a
logged in message is shown on every page).  So I figured out how to do
this:

<?python
      from cherrpy import request
      forward_url = request.browser_url
?>
<input py:if="forward_url" type="hidden" name="forward_url" value="$
{forward_url}"/>

So my question is, isn't there some other way of getting the request
object in the template?  Shouldn't that be exposed without an import
and such?

I am coming from doing a lot of java work, and in JSP you can always
get at the current request object in the templating language, and
sometimes it is useful and valid (such as this case).

Thanks,

James
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to