Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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 authored September 10, 2010

Showing 1 changed file with 6 additions and 0 deletions. Show diff stats Hide diff stats

  1. 6  django/conf/__init__.py
6  django/conf/__init__.py
@@ -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

0 notes on commit 27265f7

Please sign in to comment.
Something went wrong with that request. Please try again.