Thank you both for your help and patience with this. Oversight on my part-- 

I was mistaken by the ticket thrown - the first ticket I got when running 
this was for the 'message' (which i tried to cast to string to fix it 
before i posted here) param in the email, but then after that i was getting 
very similar tickets for other fields, at least some of which were still 
lazyT (e.g. subject). So, i'd actually begun to fix the problem by casting 
to str() as you both suggested, but kept throwing tickets and didn't look 
at those additional tickets closely enough to realize that i'd already 
begun to fix the problem.. :0  Then i started messing around in the console 
and posted here about those errors, too. 

Bottom line - problems went away by casting the lazyT to str() like you 
recommended. :)



On Thursday, February 8, 2018 at 6:37:37 PM UTC-7, Anthony wrote:
>
> 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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to