Ticket #2315: windows_timezone_fix.patch

File windows_timezone_fix.patch, 1.0 KB (added by Chris Beaven, 18 years ago)

Fix for windows timezone problems with development server

  • django/conf/__init__.py

     
    88
    99import os
    1010from django.conf import global_settings
     11import time
    1112
    1213ENVIRONMENT_VARIABLE = "DJANGO_SETTINGS_MODULE"
    1314
     
    105106                new_installed_apps.append(app)
    106107        self.INSTALLED_APPS = new_installed_apps
    107108
    108         # move the time zone info into os.environ
    109         os.environ['TZ'] = self.TIME_ZONE
     109        # If time doesn't have tzset (Windows environment), changing the local
     110        # timezone doesn't work. In fact, in the development server this causes
     111        # the timezone in Python to be set to UTC no matter what self.TIME_ZONE
     112        # is.  So for now, the TIME_ZONE setting is ignored in Windows.
     113        if hasattr(time, 'tzset'):
     114            # move the time zone info into os.environ
     115            os.environ['TZ'] = self.TIME_ZONE
    110116
    111117    def get_all_members(self):
    112118        return dir(self)
Back to Top