[IMP]:moved from misc to config file and allowed the server die if the timezone is not valid.

bzr revid: nch@tinyerp.com-20110509094448-vdfs3rmbcm5tw6n4
This commit is contained in:
Naresh (OpenERP) 2011-05-09 15:14:48 +05:30
parent 418f8b2cbc
commit fb753b29ee
2 changed files with 3 additions and 7 deletions

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
@ -349,7 +349,8 @@ class configmanager(object):
self.options['update'] = opt.update and dict.fromkeys(opt.update.split(','), 1) or {}
self.options['translate_modules'] = opt.translate_modules and map(lambda m: m.strip(), opt.translate_modules.split(',')) or ['all']
self.options['translate_modules'].sort()
die(self.options['timezone'] and not isinstance(self.options['timezone'], basestring),
"Invalid timezone value in configuration or environment: %r, Please fix this in your configuration" %(self.options['timezone']))
if self.options['timezone']:
# If an explicit TZ was provided in the config, make sure it is known
try:

View File

@ -1283,11 +1283,6 @@ def detect_server_timezone():
def get_server_timezone():
# timezone detection is safe in multithread, so lazy init is ok here
if config['timezone'] and \
not isinstance(config['timezone'], basestring):
loglevels.Logger().notifyChannel("detect_server_timezone", loglevels.LOG_WARNING,
"Invalid timezone value in configuration or environment: %r, using UTC instead. Please fix this in your configuration" %(config['timezone']))
return 'UTC'
if (not config['timezone']):
config['timezone'] = detect_server_timezone()
return config['timezone']