Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed #2315 -- added work around for Windows timezone setting (i.e. w…

…e can't do

it). This will work until somebody wants to write some full Win32 timezone changing code for us. Thanks to Marc Fargas and SmileyChris for the combined patch.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@4487 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 80e58b3211ae54754b734a409d5b944117d7963d 1 parent 6c47577
Malcolm Tredinnick authored February 12, 2007
1  AUTHORS
@@ -79,6 +79,7 @@ answer newbie questions, and generally made Django that much better:
79 79
     Andy Dustman <farcepest@gmail.com>
80 80
     Clint Ecker
81 81
     Enrico <rico.bl@gmail.com>
  82
+    Marc Fargas <telenieko@telenieko.com>
82 83
     favo@exoweb.net
83 84
     Eric Floehr <eric@intellovations.com>
84 85
     gandalf@owca.info
7  django/conf/__init__.py
@@ -7,6 +7,7 @@
7 7
 """
8 8
 
9 9
 import os
  10
+import time     # Needed for Windows
10 11
 from django.conf import global_settings
11 12
 
12 13
 ENVIRONMENT_VARIABLE = "DJANGO_SETTINGS_MODULE"
@@ -105,8 +106,10 @@ def __init__(self, settings_module):
105 106
                 new_installed_apps.append(app)
106 107
         self.INSTALLED_APPS = new_installed_apps
107 108
 
108  
-        # move the time zone info into os.environ
109  
-        os.environ['TZ'] = self.TIME_ZONE
  109
+        if hasattr(time, 'tzset'):
  110
+            # Move the time zone info into os.environ. See ticket #2315 for why
  111
+            # we don't do this unconditionally (breaks Windows).
  112
+            os.environ['TZ'] = self.TIME_ZONE
110 113
 
111 114
     def get_all_members(self):
112 115
         return dir(self)
2  django/conf/project_template/settings.py
@@ -18,6 +18,8 @@
18 18
 
19 19
 # Local time zone for this installation. All choices can be found here:
20 20
 # http://www.postgresql.org/docs/8.1/static/datetime-keywords.html#DATETIME-TIMEZONE-SET-TABLE
  21
+# If running in a Windows environment this must be set to the same as your
  22
+# system time zone.
21 23
 TIME_ZONE = 'America/Chicago'
22 24
 
23 25
 # Language code for this installation. All choices can be found here:
5  docs/settings.txt
@@ -827,6 +827,11 @@ manual configuration option (see below), Django will *not* touch the ``TZ``
827 827
 environment variable, and it'll be up to you to ensure your processes are
828 828
 running in the correct environment.
829 829
 
  830
+.. note::
  831
+    Django cannot reliably use alternate time zones in a Windows environment.
  832
+    When running Django on Windows this variable must be set to match the
  833
+    system timezone.
  834
+
830 835
 URL_VALIDATOR_USER_AGENT
831 836
 ------------------------
832 837
 

0 notes on commit 80e58b3

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