Il giorno mar, 15/12/2009 alle 07.37 -0800, mdipierro ha scritto: > We had a long discussion about this. We had a minor change of behavior > that basically assumes the default language is English. We did not > make such assumptions before. I opposed such change but apparently I > was the only one and everybody else spoke for it. Now you have to be > explicit about the fact that your language is Italian (somewhere > before you use T): > > T.current_languages=['it','it-it']
Thank you, using your suggestion I found the solution which consist in calling the following function in every controller: def set_default_language(T, request): # We assume the project is in italian language T.current_languages = ['it','it-it'] # Get choosen language from the user lang = request.env.http_accept_language.split(",")[0] if lang.find('-') != -1: lang = lang.split('-')[0] T.force(lang) > This may be a concurrency issue. Make sure you lock the file while > writing in it from a your own python program. You are right, I think the problem is that in the earlier version there were no lock on language file. A diff from my revision (992) and the latest (1458) shows that you change the way the language file is opened def write_dict(filename, contents): - f = open(filename, 'w') - f.write('{\n') + fp = open(filename, 'w') + portalocker.lock(fp, portalocker.LOCK_EX) + fp.write('# coding: utf8\n{\n') for key in sorted(contents): - f.write('%s: %s,\n' % (repr(key), repr(contents[key]))) - f.write('}\n') - f.close() + fp.write('%s: %s,\n' % (repr(key), repr(contents[key]))) + fp.write('}\n') + portalocker.unlock(fp) + fp.close() So I needed the latest revision to fix the main issue, but without the fix you suggest me I wasn't able to get it work Thank you very much -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@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.