Reviewers: ,


Please review this at http://codereview.tryton.org/246001/

Affected files:
  M CHANGELOG
  M etc/trytond.conf
  M trytond/config.py
  M trytond/protocols/dispatcher.py


Index: CHANGELOG
===================================================================

--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,3 +1,4 @@
+* Allow to customize server timezone
 * Add support of fields.Time
 * Replace nested view by reference id
 * Remove underscore to ir.translation methods

Index: etc/trytond.conf
===================================================================

--- a/etc/trytond.conf
+++ b/etc/trytond.conf
@@ -86,3 +86,6 @@

 # Default database language code
 # language = en_US
+
+# Timezone of the server
+# timezone = False

Index: trytond/config.py
===================================================================

--- a/trytond/config.py
+++ b/trytond/config.py
@@ -11,6 +11,7 @@
     sys.modules['cdecimal'] = decimal
 import os
 import ConfigParser
+import time

 def get_hostname(netloc):
     if '[' in netloc and ']' in netloc:
@@ -76,9 +77,15 @@
             '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)


Index: trytond/protocols/dispatcher.py
===================================================================

--- a/trytond/protocols/dispatcher.py
+++ b/trytond/protocols/dispatcher.py
@@ -54,7 +54,7 @@
         elif method == 'version':
             return VERSION
         elif method == 'timezone_get':
-            return time.tzname[0]
+            return CONFIG['timezone']
         elif method == 'list_lang':
             return [
                 ('bg_BG', 'Български'),



--
[email protected] mailing list

Reply via email to