[MERGE] lp:912793 (account/demo: fix last day of February period)
[odoo/odoo.git] / openerp-server
index f176279..334c179 100755 (executable)
@@ -42,6 +42,9 @@ import openerp
 __author__ = openerp.release.author
 __version__ = openerp.release.version
 
+import sys
+import imp
+
 def check_root_user():
     """ Exit if the process's user is 'root' (on POSIX system)."""
     if os.name == 'posix':
@@ -140,7 +143,6 @@ def import_translation():
     cr = openerp.pooler.get_db(dbname).cursor()
     openerp.tools.trans_load( cr, config["translate_in"], config["language"],
         context=context)
-    openerp.tools.trans_update_res_ids(cr)
     cr.commit()
     cr.close()
 
@@ -179,9 +181,12 @@ def dumpstacks(sig, frame):
 def setup_signal_handlers():
     """ Register the signal handler defined above. """
     SIGNALS = map(lambda x: getattr(signal, "SIG%s" % x), "INT TERM".split())
-    map(lambda sig: signal.signal(sig, signal_handler), SIGNALS)
     if os.name == 'posix':
+        map(lambda sig: signal.signal(sig, signal_handler), SIGNALS)
         signal.signal(signal.SIGQUIT, dumpstacks)
+    elif os.name == 'nt':
+        import win32api
+        win32api.SetConsoleCtrlHandler(lambda sig: signal_handler(sig, None), 1)
 
 def quit_on_signals():
     """ Wait for one or two signals then shutdown the server.
@@ -191,9 +196,12 @@ def quit_on_signals():
 
     """
     # Wait for a first signal to be handled. (time.sleep will be interrupted
-    # by the signal handler.)
-    while quit_signals_received == 0:
-        time.sleep(60)
+    # by the signal handler.) The try/except is for the win32 case.
+    try:
+        while quit_signals_received == 0:
+            time.sleep(60)
+    except KeyboardInterrupt, e:
+        pass
 
     if config['pidfile']:
         os.unlink(config['pidfile'])
@@ -207,6 +215,7 @@ if __name__ == "__main__":
 
     check_root_user()
     openerp.tools.config.parse_config(sys.argv[1:])
+
     check_postgres_user()
     openerp.netsvc.init_logger()
     report_configuration()