[TYPO] Set the right category for the Point Of Sale
[odoo/odoo.git] / openerp-server
index 97be3a8..12b6962 100755 (executable)
@@ -165,11 +165,16 @@ def dumpstacks(sig, frame):
     """ Signal handler: dump a stack trace for each existing thread."""
     # code from http://stackoverflow.com/questions/132058/getting-stack-trace-from-a-running-python-application#answer-2569696
     # modified for python 2.5 compatibility
-    thread_map = dict(threading._active, **threading._limbo)
-    id2name = dict([(threadId, thread.getName()) for threadId, thread in thread_map.items()])
+    threads_info = dict([(th.ident, {'name': th.name,
+                                    'uid': getattr(th,'uid','n/a')})
+                                for th in threading.enumerate()])
     code = []
     for threadId, stack in sys._current_frames().items():
-        code.append("\n# Thread: %s(%d)" % (id2name[threadId], threadId))
+        thread_info = threads_info.get(threadId)
+        code.append("\n# Thread: %s (id:%s) (uid:%s)" % \
+                    (thread_info and thread_info['name'] or 'n/a',
+                     threadId,
+                     thread_info and thread_info['uid'] or 'n/a'))
         for filename, lineno, name, line in traceback.extract_stack(stack):
             code.append('File: "%s", line %d, in %s' % (filename, lineno, name))
             if line:
@@ -207,6 +212,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 +231,8 @@ if __name__ == "__main__":
 
     config = openerp.tools.config
 
+    configure_babel_localedata_path()
+
     setup_signal_handlers()
 
     if config["test_file"]:
@@ -241,10 +254,7 @@ if __name__ == "__main__":
 
     for m in openerp.conf.server_wide_modules:
         try:
-            if m not in openerp.modules.module.loaded:
-                __import__('openerp.addons.' + m)
-                openerp.modules.module.loaded.append(m)
-                openerp.modules.module.call_post_load_hook(m)
+            openerp.modules.module.load_openerp_module(m)
         except Exception:
             msg = ''
             if m == 'web':