On Dec 31, 2010, at 9:43 AM, mdipierro wrote: > > This is a complex issue. I have been experimenting with turning > > request, response, session, cache and T > > in thread local singletons. > > This will fixed a lot of the problem and would allow to create modules > that use those variables without having to pass the explicitly. The > issues are: > > - will this make web2py slower (of faster?) > - will this break something?
It'll break application threads, but you've convinced me that they're a bad thing. Can you explain to us what's happening now? Why, when a validator is called from a model, it doesn't see T? > > massimo > > > > > On Dec 31, 10:54 am, DenesL <denes1...@yahoo.ca> wrote: >> The problem is that those messages are defined internally in the >> validator and can not be set via error_message. >> >> An easy solution would be to wrap them in a T call but that results >> in: >> NameError: global name 'T' is not defined, line 188, in restricted >> >> So the question is why T can not be part of the environment variable >> when it is available at the model level. >> >> On Dec 31, 11:26 am, Jonathan Lundell <jlund...@pobox.com> wrote: >> >>> On Dec 31, 2010, at 6:18 AM, Martin Weissenboeck wrote: >> >>>> I want to translate my web page to German. The T()"operator" is very fine, >>>> but I could not find any way to translate message like >>>> "enter an integer less than or equal to %(max)g" >>>> in class IS_INT_IN_RANGE. >> >>>> I think it is very unprofessional to mix English and German words and I >>>> have tried to find a solution. >> >>> Am I correct that you had to make the translation entries manually (because >>> the T() search doesn't look in gluon)? >> >>> I assume that the current logic was written with the intention of passing >>> in error_message=T(something); does that work too? >> >>> I wonder whether there isn't a general solution that would let us use T() >>> in gluon code that's invoked by applications. >> >>>> I have changed the following lines (file validators.py, class >>>> IS_INT_IN_RANGE) >> >>