From fb753b29eede7df92c5bfbd62c780783398baa25 Mon Sep 17 00:00:00 2001 From: "Naresh (OpenERP)" Date: Mon, 9 May 2011 15:14:48 +0530 Subject: [PATCH] [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 --- openerp/tools/config.py | 5 +++-- openerp/tools/misc.py | 5 ----- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/openerp/tools/config.py b/openerp/tools/config.py index 1ae839ba65d..9bc15bb128a 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 @@ -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: diff --git a/openerp/tools/misc.py b/openerp/tools/misc.py index 401d10ee035..e1a6a717e87 100644 --- a/openerp/tools/misc.py +++ b/openerp/tools/misc.py @@ -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']