Force UTC as timezone
issue3444 review1411002
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
* Force UTC as timezone (migration script available on tryton-tools)
|
||||
* Add relation_field for many2one
|
||||
|
||||
Version 3.0.0 - 2013-10-21
|
||||
|
||||
@@ -17,7 +17,6 @@ Prerequisites
|
||||
* Optional: MySQL-python (http://sourceforge.net/projects/mysql-python/)
|
||||
* Optional: pywebdav 0.9.8 or later (http://code.google.com/p/pywebdav/)
|
||||
* Optional: pydot (http://code.google.com/p/pydot/)
|
||||
* Optional: pytz (http://pytz.sourceforge.net/)
|
||||
* Optional: unoconv http://dag.wieers.com/home-made/unoconv/)
|
||||
* Optional: sphinx (http://sphinx.pocoo.org/)
|
||||
* Optional: simplejson (http://undefined.org/python/#simplejson)
|
||||
|
||||
@@ -86,6 +86,3 @@ jsonrpc = localhost:8000
|
||||
|
||||
# Default language code
|
||||
# language = en_US
|
||||
|
||||
# Timezone of the server
|
||||
# timezone = False
|
||||
|
||||
@@ -70,7 +70,6 @@ setup(name=PACKAGE,
|
||||
'WebDAV': ['PyWebDAV >= 0.9.8'],
|
||||
'unoconv': ['unoconv'],
|
||||
'graphviz': ['pydot'],
|
||||
'timezone': ['pytz'],
|
||||
'simplejson': ['simplejson'],
|
||||
'cdecimal': ['cdecimal'],
|
||||
'Levenshtein': ['python-Levenshtein'],
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
#This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||
#this repository contains the full copyright notices and license terms.
|
||||
import os
|
||||
import time
|
||||
|
||||
from . import server
|
||||
|
||||
__all__ = ['server']
|
||||
|
||||
os.environ['TZ'] = 'UTC'
|
||||
if hasattr(time, 'tzset'):
|
||||
time.tzset()
|
||||
|
||||
@@ -11,7 +11,6 @@ except ImportError:
|
||||
sys.modules['cdecimal'] = decimal
|
||||
import os
|
||||
import ConfigParser
|
||||
import time
|
||||
import getpass
|
||||
import socket
|
||||
|
||||
@@ -84,15 +83,9 @@ 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)
|
||||
|
||||
|
||||
+2
-2
@@ -22,8 +22,8 @@ class Date(Model):
|
||||
})
|
||||
|
||||
@staticmethod
|
||||
def today():
|
||||
def today(timezone=None):
|
||||
'''
|
||||
Return the current date
|
||||
'''
|
||||
return datetime.date.today()
|
||||
return datetime.datetime.now(timezone).date()
|
||||
|
||||
@@ -56,8 +56,6 @@ def dispatch(host, port, protocol, database_name, user, session, object_type,
|
||||
return True
|
||||
elif method == 'version':
|
||||
return VERSION
|
||||
elif method == 'timezone_get':
|
||||
return CONFIG['timezone']
|
||||
elif method == 'list_lang':
|
||||
return [
|
||||
('bg_BG', 'Български'),
|
||||
|
||||
@@ -23,13 +23,6 @@ from ..config import CONFIG
|
||||
from ..pyson import PYSONEncoder
|
||||
from ..rpc import RPC
|
||||
|
||||
try:
|
||||
import pytz
|
||||
TIMEZONES = [(x, x) for x in pytz.common_timezones]
|
||||
except ImportError:
|
||||
TIMEZONES = []
|
||||
TIMEZONES += [(None, '')]
|
||||
|
||||
__all__ = [
|
||||
'User', 'LoginAttempt', 'UserAction', 'UserGroup', 'Warning_',
|
||||
'UserConfigStart', 'UserConfig',
|
||||
@@ -61,7 +54,6 @@ class User(ModelSQL, ModelView):
|
||||
])
|
||||
language_direction = fields.Function(fields.Char('Language Direction'),
|
||||
'get_language_direction')
|
||||
timezone = fields.Selection(TIMEZONES, 'Timezone', translate=False)
|
||||
email = fields.Char('Email')
|
||||
status_bar = fields.Function(fields.Char('Status Bar'), 'get_status_bar')
|
||||
warnings = fields.One2Many('res.user.warning', 'user', 'Warnings')
|
||||
@@ -97,7 +89,6 @@ class User(ModelSQL, ModelView):
|
||||
cls._context_fields = [
|
||||
'language',
|
||||
'language_direction',
|
||||
'timezone',
|
||||
'groups',
|
||||
]
|
||||
cls._error_messages.update({
|
||||
|
||||
@@ -29,8 +29,6 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<page string="Preferences" col="2" id="preferences">
|
||||
<label name="language"/>
|
||||
<field name="language" widget="selection"/>
|
||||
<label name="timezone"/>
|
||||
<field name="timezone"/>
|
||||
</page>
|
||||
</notebook>
|
||||
</form>
|
||||
|
||||
@@ -24,8 +24,6 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<page string="Preferences" col="2" id="preferences">
|
||||
<label name="language"/>
|
||||
<field name="language" widget="selection"/>
|
||||
<label name="timezone"/>
|
||||
<field name="timezone"/>
|
||||
</page>
|
||||
</notebook>
|
||||
</form>
|
||||
|
||||
@@ -29,7 +29,6 @@ class TrytonServer(object):
|
||||
|
||||
CONFIG.update_etc(options['configfile'])
|
||||
CONFIG.update_cmdline(options)
|
||||
CONFIG.set_timezone()
|
||||
|
||||
if CONFIG['logfile']:
|
||||
logf = CONFIG['logfile']
|
||||
|
||||
@@ -38,7 +38,6 @@ if __name__ == '__main__':
|
||||
from trytond.config import CONFIG
|
||||
CONFIG['db_type'] = 'sqlite'
|
||||
CONFIG.update_etc(_CONFIGFILE)
|
||||
CONFIG.set_timezone()
|
||||
if not CONFIG['admin_passwd']:
|
||||
CONFIG['admin_passwd'] = 'admin'
|
||||
|
||||
|
||||
Reference in New Issue
Block a user