summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVo Minh Thu <vmt@openerp.com>2011-05-09 14:19:10 +0200
committerVo Minh Thu <vmt@openerp.com>2011-05-09 14:19:10 +0200
commit35239e8e201e6bf7f2c6c77ca59cc6445150be67 (patch)
treec2e0a465fe99e7f4938edfedccac6d664e52a816
parent84c0e981ec15fb8015fcaead877ea5faebce9dc2 (diff)
parentfb753b29eede7df92c5bfbd62c780783398baa25 (diff)
[MERGE] check the type of the timezone parameter (prevent it to be True).
bzr revid: vmt@openerp.com-20110509121910-odhcv8134jt2ghor
-rw-r--r--openerp/tools/config.py13
-rw-r--r--openerp/tools/misc.py2
2 files changed, 13 insertions, 2 deletions
diff --git a/openerp/tools/config.py b/openerp/tools/config.py
index 1ae839ba65d..edceb08f475 100644
--- a/openerp/tools/config.py
+++ b/openerp/tools/config.py
@@ -32,7 +32,7 @@ def check_ssl():
try:
from OpenSSL import SSL
import socket
-
+
return hasattr(socket, 'ssl') and hasattr(SSL, "Connection")
except:
return False
@@ -350,7 +350,18 @@ class configmanager(object):
self.options['translate_modules'] = opt.translate_modules and map(lambda m: m.strip(), opt.translate_modules.split(',')) or ['all']
self.options['translate_modules'].sort()
+ # TODO checking the type of the parameters should be done for every
+ # parameters, not just the timezone.
+ # The call to get_server_timezone() sets the timezone; this should
+ # probably done here.
if self.options['timezone']:
+ # Prevent the timezone to be True. (The config file parsing changes
+ # the string 'True' to the boolean value True. It would be probably
+ # be better to remove that conversion.)
+ die(not isinstance(self.options['timezone'], basestring),
+ "Invalid timezone value in configuration or environment: %r.\n"
+ "Please fix this in your configuration." %(self.options['timezone']))
+
# If an explicit TZ was provided in the config, make sure it is known
try:
import pytz
diff --git a/openerp/tools/misc.py b/openerp/tools/misc.py
index 1524d95d922..e1a6a717e87 100644
--- a/openerp/tools/misc.py
+++ b/openerp/tools/misc.py
@@ -159,7 +159,7 @@ def exec_pg_command(name, *args):
if not prog:
raise Exception('Couldn\'t find %s' % name)
args2 = (prog,) + args
-
+
return subprocess.call(args2)
def exec_pg_command_pipe(name, *args):