diff --git a/CHANGELOG b/CHANGELOG index d6bee73fdc..0436672f6c 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,4 @@ +* Allow to customize server timezone * Add richtext widget for WYSIWYG editor * Add support of fields.Time * Replace nested view by reference id diff --git a/etc/trytond.conf b/etc/trytond.conf index 027a6c0d1c..f2efd761a8 100644 --- a/etc/trytond.conf +++ b/etc/trytond.conf @@ -86,3 +86,6 @@ jsonrpc = localhost:8000 # Default database language code # language = en_US + +# Timezone of the server +# timezone = False diff --git a/trytond/config.py b/trytond/config.py index ccc926af2d..3722047f82 100644 --- a/trytond/config.py +++ b/trytond/config.py @@ -11,6 +11,7 @@ except ImportError: sys.modules['cdecimal'] = decimal import os import ConfigParser +import time def get_hostname(netloc): if '[' in netloc and ']' in netloc: @@ -76,9 +77,15 @@ class ConfigManager(object): 'unoconv': 'pipe,name=trytond;urp;StarOffice.ComponentContext', 'retry': 5, 'language': 'en_US', + 'timezone': time.tzname[0] or time.tzname[1], } self.configfile = None + def set_timezone(self): + os.environ['TZ'] = self.get('timezone') + if hasattr(time, 'tzset'): + time.tzset() + def update_cmdline(self, cmdline_options): self.options.update(cmdline_options) diff --git a/trytond/protocols/dispatcher.py b/trytond/protocols/dispatcher.py index 1e37dd81bf..041515b34f 100644 --- a/trytond/protocols/dispatcher.py +++ b/trytond/protocols/dispatcher.py @@ -54,7 +54,7 @@ def dispatch(host, port, protocol, database_name, user, session, object_type, elif method == 'version': return VERSION elif method == 'timezone_get': - return time.tzname[0] + return CONFIG['timezone'] elif method == 'list_lang': return [ ('bg_BG', 'Български'),