On Thursday, February 8, 2018 at 2:49:52 PM UTC-5, Jordan Ladora wrote:
>
> Trying to get this to work but not getting anywhere-
>
> *from gluon import languages  # EDITED from '*
>
> *from gluon import *'abc = languages.lazyT("abc")*
>

The lazyT class takes a "T" argument, which should be in instance of the 
"translator" class.
 

> I have a library that expects a basestring object but w2p in that context 
> returns a lazyT (this is for password reset using a commercial service as a 
> mailer). Specifically, this is gluon/tools.py line 3637 - the 'message' 
> param is a lazyT object and I need a string.
>

auth.messages is an instance of gluon.storage.Messages -- when you retrieve 
an attribute, it passes the value to current.T, which yields the lazyT 
object. You can simply pass the value to str() to convert it to the 
translated string.

Anthony

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to