On Jan 3, 6:47 am, Jaroslaw Zabiello <[email protected]> wrote: > I do not like the way web2py distinguish 'en' and 'en-en' as two > different languages, so I wrote a simple code which fix it. > lang = request.env.http_accept_language.split(',')[0].split(';') > [0].split('-')[0] > if lang not in [all_available_languages]: lang = DEFAULT_LANG > T.force(lang)
Nice - I may use this :) Probably as a customisable policy since it can get 'political' ;) > 1. Where to put Python code which should be shared by all web2py > controllers but also parsed on *every* request? I found that T.force() > has to be executed BEFORE any T() method is used otherwise it won't > work. Does this help? https://mdp.cti.depaul.edu/web2py_wiki/default/wiki/tips "models are executed for every action (controller function)" > 2. Where is the best place for global variables (variables available > in all controllers, but parsed only once) I put global variables in my model, but I guess a module might be better as then parsed only once? F --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" 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/web2py?hl=en -~----------~----~----~----~------~----~------~--~---

