Skip to content

Commit e193ab6

Browse files
committed
Fix Issue2551030: Roundup fails to start if pytz to access Olson
timezone database not installed Create property TimezoneOption.defaulttz properly and use it to initialize the entry in the SETTINGS data structure for the timezone option.
1 parent 6fa3d48 commit e193ab6

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

CHANGES.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ v2.7.2 is required to run newer releases of Roundup. From v?.?
1212
onwards Python 3.4 and later are also supported.
1313

1414

15-
2018-??-?? ?.?.0
15+
2019-??-?? ?.?.0
1616

1717
Features:
1818

@@ -143,6 +143,8 @@ Fixed:
143143
- issue2551009: Flint not supported error during reindex. Upgrading
144144
doc updates to discuss this when reindexing. (Reported by Gabi,
145145
Change by John Rouillard)
146+
- issue2551030: Roundup fails to start if pytz to access Olson
147+
timezone database not installed. (John Rouillard)
146148

147149
2018-07-13 1.6.0
148150

roundup/configuration.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -544,6 +544,14 @@ class TimezoneOption(Option):
544544
"If pytz is not installed, value must be integer number\n" \
545545
"giving local timezone offset from UTC in hours."
546546

547+
# fix issue2551030, default value for timezone
548+
# Must be 0 if no pytz can be UTC if pytz.
549+
try:
550+
import pytz
551+
defaulttz = "UTC"
552+
except ImportError:
553+
defaulttz = "0"
554+
547555
def str2value(self, value):
548556
try:
549557
roundup.date.get_timezone(value)
@@ -552,6 +560,7 @@ def str2value(self, value):
552560
"Timezone name or numeric hour offset required")
553561
return value
554562

563+
555564
class RegExpOption(Option):
556565

557566
"""Regular Expression option (value is Regular Expression Object)"""
@@ -658,7 +667,8 @@ def str2value(self, value):
658667
"If you wish to make them xhtml, then you'll need to change this\n"
659668
"var to 'xhtml' too so all auto-generated HTML is compliant.\n"
660669
"Allowed values: html4, xhtml"),
661-
(TimezoneOption, "timezone", "UTC", "Default timezone offset,"
670+
(TimezoneOption, "timezone", TimezoneOption.defaulttz,
671+
"Default timezone offset,"
662672
" applied when user's timezone is not set.",
663673
["DEFAULT_TIMEZONE"]),
664674
(BooleanOption, "instant_registration", "no",

0 commit comments

Comments
 (0)