To be more precise, I'm using mako as template engine.
I know there is function http.url and I managed to use it this way:
created file utils.py:
from web.http import url as url_
def url(context, path=None, **kw):
return url_(path, **kw)
and in my template used:
<%namespace name="utils" module="utils" />
<a href="${utils.url("/main")}">link</a>
I'm wonder, how you guys deal with this?
Regards,
tomekM
On 23 Wrz, 14:52, tomekM <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I'm just curious how do you deal with links (<a href>) in your templates. I
> mean, how not to hardcode them in template.
>
> I see two solutions. One is to prepare all links in view function and pass
> them as parameters to template where, you just have to use them in href.
> The other way is to use some function which will compute the href based on
> some parameters, like {% url %} tag in Django. It takes path to module with
> view's function (e.g. views.main), searches it on urls list and tries to
> figure out what is an original url of it.
>
> How do you make it in your webapps based on web.py? Is there a ready-to-use
> helper function? If yes, how to use it? Or you have written your own
> solution?
>
> tomekM
>
> --
> If you had one shot, or one opportunity
> To seize everything you ever wanted - One moment
> Would you capture it or just let it slip?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web.py" 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/webpy?hl=en
-~----------~----~----~----~------~----~------~--~---