File tree Expand file tree Collapse file tree 1 file changed +6
-0
lines changed Expand file tree Collapse file tree 1 file changed +6
-0
lines changed Original file line number Diff line number Diff line change @@ -103,6 +103,12 @@ def __init__(self, settings_module):
103
103
self .INSTALLED_APPS = new_installed_apps
104
104
105
105
if hasattr (time , 'tzset' ) and getattr (self , 'TIME_ZONE' ):
106
+ # When we can, attempt to validate the timezone. If we can't find
107
+ # this file, no check happens and it's harmless.
108
+ zoneinfo_root = '/usr/share/zoneinfo'
109
+ if (os .path .exists (zoneinfo_root ) and not
110
+ os .path .exists (os .path .join (zoneinfo_root , * (self .TIME_ZONE .split ('/' ))))):
111
+ raise ValueError ("Incorrect timezone setting: %s" % self .TIME_ZONE )
106
112
# Move the time zone info into os.environ. See ticket #2315 for why
107
113
# we don't do this unconditionally (breaks Windows).
108
114
os .environ ['TZ' ] = self .TIME_ZONE
You can’t perform that action at this time.
0 commit comments