The best way is to pass T as you pass request. T is an instance (not a
function) that is initialized from the request.

request, response, session, cache, T and databases should not have
multiple instances.

Massimo

On Dec 20, 12:58 pm, Tari <robert.t...@gmail.com> wrote:
> Hello,
>
> I'm using a separate py module (in the modules folder) for some of my
> code. I understand that gluon objects must be explicitly imported,
> since they are not globally visible as with controllers and models. I
> had no problem with that except for the T().
>
> Here's a sample code:
>
> from gluon.html import *
> from gluon.languages import *
>
> def Lnk(request):
>     return A(T("link text"), _href = URL(r = request, c =
> "controller", f = "function"))
>
> And here's the error:
>
> NameError: global name 'T' is not defined
>
> How can I use the lazyT in a module?
>
> Thank you
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to