[MERGE] check the type of the timezone parameter (prevent it to be True).

bzr revid: vmt@openerp.com-20110509121910-odhcv8134jt2ghor
This commit is contained in:
Vo Minh Thu
2011-05-09 14:19:10 +02:00
2 changed files with 13 additions and 2 deletions
+12 -1
View File
@@ -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
+1 -1
View File
@@ -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):