summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVo Minh Thu <vmt@openerp.com>2013-03-07 13:16:37 +0100
committerVo Minh Thu <vmt@openerp.com>2013-03-07 13:16:37 +0100
commit4a77c6a0c5bdbcc3a5dae48dc73caa0fa4550430 (patch)
tree980434a64118ea80493ea4780c9c622fc5f633a3
parent9bb7ff34134805b37ecb027c12462246c44e5fff (diff)
[FIX] timezone: under windows os.environ["TZ"] was not affecting the server,
now it does (probably because we make sure to first set the environment *then* import the time module. Works fine under Windows XP. lp bug: https://launchpad.net/bugs/1038017 fixed bzr revid: vmt@openerp.com-20130307121637-47fac72clykizlnj
-rw-r--r--openerp/__init__.py11
-rw-r--r--openerp/cli/server.py2
2 files changed, 11 insertions, 2 deletions
diff --git a/openerp/__init__.py b/openerp/__init__.py
index 1db7b616199..02f879c4929 100644
--- a/openerp/__init__.py
+++ b/openerp/__init__.py
@@ -22,6 +22,17 @@
""" OpenERP core library.
"""
+
+# Make sure the OpenERP server runs in UTC. This is especially necessary
+# under Windows as under Linux it seems the real import of time is
+# sufficiently deferred so that setting the TZ environment variable
+# in openerp.cli.server was working.
+import os
+os.environ['TZ'] = 'UTC' # Set the timezone...
+import time # ... *then* import time.
+del os
+del time
+
# The hard-coded super-user id (a.k.a. administrator, or root user).
SUPERUSER_ID = 1
diff --git a/openerp/cli/server.py b/openerp/cli/server.py
index fdde56bc912..549b6529aa5 100644
--- a/openerp/cli/server.py
+++ b/openerp/cli/server.py
@@ -219,8 +219,6 @@ def quit_on_signals():
sys.exit(0)
def main(args):
- os.environ["TZ"] = "UTC"
-
check_root_user()
openerp.tools.config.parse_config(args)