Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

When possible, sanity check the timezone setting to see if the Unix-like

box it's running on supports that setting. If checking isn't possible,
we skip it. Patch from seveas. Thanks.

Fixed #3415.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@13722 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 27265f70a18ab8fb4bfacad0cdebe170c342054c 1 parent 255147c
Malcolm Tredinnick malcolmt authored
Showing with 6 additions and 0 deletions.
  1. +6 −0 django/conf/__init__.py
6 django/conf/__init__.py
View
@@ -103,6 +103,12 @@ def __init__(self, settings_module):
self.INSTALLED_APPS = new_installed_apps
if hasattr(time, 'tzset') and getattr(self, 'TIME_ZONE'):
+ # When we can, attempt to validate the timezone. If we can't find
+ # this file, no check happens and it's harmless.
+ zoneinfo_root = '/usr/share/zoneinfo'
+ if (os.path.exists(zoneinfo_root) and not
+ os.path.exists(os.path.join(zoneinfo_root, *(self.TIME_ZONE.split('/'))))):
+ raise ValueError("Incorrect timezone setting: %s" % self.TIME_ZONE)
# Move the time zone info into os.environ. See ticket #2315 for why
# we don't do this unconditionally (breaks Windows).
os.environ['TZ'] = self.TIME_ZONE
Please sign in to comment.
Something went wrong with that request. Please try again.