[FIX] babel: Set the right path for the localedata of Babel when we use it via the...
authorStephane Wirtel <stw@openerp.com>
Tue, 14 Feb 2012 11:44:47 +0000 (12:44 +0100)
committerStephane Wirtel <stw@openerp.com>
Tue, 14 Feb 2012 11:44:47 +0000 (12:44 +0100)
lp bug: https://launchpad.net/bugs/917565 fixed

bzr revid: stw@openerp.com-20120214114447-f8k2ze9kszfxvlw1

openerp-server

index 4ff97dd..b9fcfb3 100755 (executable)
@@ -207,6 +207,12 @@ def quit_on_signals():
     openerp.service.stop_services()
     sys.exit(0)
 
+def configure_babel_localedata_path():
+    # Workaround: py2exe and babel.
+    if hasattr(sys, 'frozen'):
+        import babel
+        babel.localedata._dirname = os.path.join(os.path.dirname(sys.executable), 'localedata')
+
 if __name__ == "__main__":
 
     os.environ["TZ"] = "UTC"
@@ -220,6 +226,8 @@ if __name__ == "__main__":
 
     config = openerp.tools.config
 
+    configure_babel_localedata_path()
+
     setup_signal_handlers()
 
     if config["test_file"]: