Cédric Krier pushed to branch branch/default at Tryton / Tryton


Commits:
ca5539c4 by Cédric Krier at 2023-01-25T00:53:43+01:00
Use tzinfo.tzname instead of key to display timezone on cron

key is a specific to ZoneInfo implementation when tzname is part tzinfo API.

Closes #12036
- - - - -


2 changed files:

- trytond/trytond/ir/cron.py
- trytond/trytond/tests/test_ir.py


Changes:

=====================================
trytond/trytond/ir/cron.py
=====================================
@@ -103,7 +103,7 @@
         table_h.not_null_action('next_call', 'remove')
 
     def get_timezone(self, name):
-        return tz.SERVER.key
+        return tz.SERVER.tzname(datetime.datetime.now())
 
     @classmethod
     def check_xml_record(cls, crons, values):


=====================================
trytond/trytond/tests/test_ir.py
=====================================
@@ -462,5 +462,12 @@
             cron.compute_next_call(datetime.datetime(2022, 11, 6, 7, 30)),
             datetime.datetime(2022, 11, 6, 8, 30))
 
+    @with_transaction()
+    def test_get_timezone(self):
+        "Test get_timezone"
+        cron = self._get_cron()
+
+        self.assertIsInstance(cron.get_timezone('timezone'), str)
+
 
 del ModuleTestCase



View it on Heptapod: 
https://foss.heptapod.net/tryton/tryton/-/commit/ca5539c4a11b65a7574e3d8d3b1ff21fcdbf5fd2

-- 
View it on Heptapod: 
https://foss.heptapod.net/tryton/tryton/-/commit/ca5539c4a11b65a7574e3d8d3b1ff21fcdbf5fd2
You're receiving this email because of your account on foss.heptapod.net.


Reply via email to