changeset 8704e9636471 in modules/company:default
details: https://hg.tryton.org/modules/company?cmd=changeset;node=8704e9636471
description:
Do not fail if pytz module can not be imported
pytz is an optional dependency.
diffstat:
ir.py | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diffs (23 lines):
diff -r 501a524268f7 -r 8704e9636471 ir.py
--- a/ir.py Thu Dec 05 23:03:52 2019 +0100
+++ b/ir.py Thu Dec 05 23:10:39 2019 +0100
@@ -1,6 +1,9 @@
# 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 pytz
+try:
+ import pytz
+except ImportError:
+ pytz = None
from trytond.model import ModelSQL, ModelView, fields, dualmethod
from trytond.pool import PoolMeta, Pool
@@ -40,7 +43,7 @@
company_id = Transaction().context.get('company')
if timezone is None and company_id:
company = Company(company_id)
- if company.timezone:
+ if company.timezone and pytz:
timezone = pytz.timezone(company.timezone)
return super(Date, cls).today(timezone=timezone)